]> Cypherpunks.ru repositories - gogost.git/blob - cmd/streebog512/main.go
41d0c6a972b3515a8cfc9984e7f53475fa0feae6
[gogost.git] / cmd / streebog512 / main.go
1 // GoGOST -- Pure Go GOST cryptographic functions library
2 // Copyright (C) 2015-2019 Sergey Matveev <stargrave@stargrave.org>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, version 3 of the License.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16 // Command-line 34.11-2012 512-bit hash function.
17 package main
18
19 import (
20         "encoding/hex"
21         "flag"
22         "fmt"
23         "io"
24         "os"
25
26         "go.cypherpunks.ru/gogost/v4"
27         "go.cypherpunks.ru/gogost/v4/gost34112012512"
28 )
29
30 var (
31         version = flag.Bool("version", false, "Print version information")
32 )
33
34 func main() {
35         flag.Parse()
36         if *version {
37                 fmt.Println(gogost.Version)
38                 return
39         }
40         h := gost34112012512.New()
41         io.Copy(h, os.Stdin)
42         fmt.Println(hex.EncodeToString(h.Sum(nil)))
43 }