]> Cypherpunks.ru repositories - gogost.git/blobdiff - src/cypherpunks.ru/gogost/cmd/gogost-streebog/main.go
Split 34.11-2012 on two different modules, add corresponding Size constant
[gogost.git] / src / cypherpunks.ru / gogost / cmd / gogost-streebog / main.go
similarity index 80%
rename from src/cypherpunks.ru/gogost/gost34112012/cmd/gogost-streebog/main.go
rename to src/cypherpunks.ru/gogost/cmd/gogost-streebog/main.go
index b6b9ff4f93f119770f36d59b3d94ca1be7720016..2817a2ac64d00e4cbd49ecb0ce3ff96e945c818c 100644 (file)
@@ -21,15 +21,17 @@ import (
        "encoding/hex"
        "flag"
        "fmt"
+       "hash"
        "io"
        "os"
 
        "cypherpunks.ru/gogost"
-       "cypherpunks.ru/gogost/gost34112012"
+       "cypherpunks.ru/gogost/gost34112012256"
+       "cypherpunks.ru/gogost/gost34112012512"
 )
 
 var (
-       digestSize = flag.Int("size", 256, "Digest size (either 256 or 512)")
+       digestSize = flag.Int("size", 256, "Digest size in bits (either 256 or 512)")
        version    = flag.Bool("version", false, "Print version information")
 )
 
@@ -39,7 +41,12 @@ func main() {
                fmt.Println(gogost.Version)
                return
        }
-       h := gost34112012.New(*digestSize)
+       var h hash.Hash
+       if *digestSize == 256 {
+               h = gost34112012256.New()
+       } else {
+               h = gost34112012512.New()
+       }
        io.Copy(h, os.Stdin)
        fmt.Println(hex.EncodeToString(h.Sum(nil)))
 }