]> Cypherpunks.ru repositories - balloon.git/commitdiff
Simple command-line utility for hashing
authorSergey Matveev <stargrave@stargrave.org>
Fri, 18 Jan 2019 22:28:02 +0000 (01:28 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 18 Jan 2019 22:28:02 +0000 (01:28 +0300)
cmd/balloon/main.go [new file with mode: 0644]

diff --git a/cmd/balloon/main.go b/cmd/balloon/main.go
new file mode 100644 (file)
index 0000000..8283a53
--- /dev/null
@@ -0,0 +1,27 @@
+package main
+
+import (
+       "crypto/sha512"
+       "encoding/hex"
+       "flag"
+       "fmt"
+
+       "cypherpunks.ru/balloon"
+)
+
+var (
+       s       = flag.Int("s", 1<<18, "Space cost, number of hash-sized blocks")
+       t       = flag.Int("t", 2, "Time cost, rounds")
+       p       = flag.Int("p", 4, "Number of threads")
+       saltHex = flag.String("salt", "deadbabe", "Salt, hexadecimal")
+       passwd  = flag.String("passwd", "", "Password")
+)
+
+func main() {
+       flag.Parse()
+       salt, err := hex.DecodeString(*saltHex)
+       if err != nil {
+               panic(err)
+       }
+       fmt.Println(hex.EncodeToString(balloon.H(sha512.New, []byte(*passwd), salt, *s, *t, *p)))
+}