]> Cypherpunks.ru repositories - balloon.git/blob - cmd/balloon/main.go
8283a5345e0432e66a73e66ef4f270768b3c06cb
[balloon.git] / cmd / balloon / main.go
1 package main
2
3 import (
4         "crypto/sha512"
5         "encoding/hex"
6         "flag"
7         "fmt"
8
9         "cypherpunks.ru/balloon"
10 )
11
12 var (
13         s       = flag.Int("s", 1<<18, "Space cost, number of hash-sized blocks")
14         t       = flag.Int("t", 2, "Time cost, rounds")
15         p       = flag.Int("p", 4, "Number of threads")
16         saltHex = flag.String("salt", "deadbabe", "Salt, hexadecimal")
17         passwd  = flag.String("passwd", "", "Password")
18 )
19
20 func main() {
21         flag.Parse()
22         salt, err := hex.DecodeString(*saltHex)
23         if err != nil {
24                 panic(err)
25         }
26         fmt.Println(hex.EncodeToString(balloon.H(sha512.New, []byte(*passwd), salt, *s, *t, *p)))
27 }