X-Git-Url: http://www.git.cypherpunks.ru/?p=balloon.git;a=blobdiff_plain;f=cmd%2Fballoon%2Fmain.go;h=9c541a42a232edcc64b764e4652b2f8b2ebbf6bf;hp=b7fd973b5874af07430ffca10b3420f1f8bc9e24;hb=6542cd28c0f00e04d8e47d7648fe1305aae0fc77;hpb=8db12c1d04f1d1bc2311c42a08812f511bfae721 diff --git a/cmd/balloon/main.go b/cmd/balloon/main.go index b7fd973..9c541a4 100644 --- a/cmd/balloon/main.go +++ b/cmd/balloon/main.go @@ -21,6 +21,7 @@ package main import ( "crypto/rand" "crypto/sha512" + "encoding/base64" "encoding/hex" "flag" "fmt" @@ -31,9 +32,9 @@ import ( ) func main() { - 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") + s := flag.Int("s", 1<<16, "Space cost, number of hash-sized blocks") + t := flag.Int("t", 3, "Time cost, rounds") + p := flag.Int("p", 1, "Number of threads") saltHex := flag.String("salt", "", "Salt, hexadecimal, optional") passwd := flag.String("passwd", "", "Password") flag.Usage = func() { @@ -52,5 +53,13 @@ func main() { if err != nil { panic(err) } - fmt.Println(hex.EncodeToString(balloon.H(sha512.New, []byte(*passwd), salt, *s, *t, *p))) + fmt.Println("Salt:", hex.EncodeToString(salt)) + h := balloon.H(sha512.New, []byte(*passwd), salt, *s, *t, *p) + fmt.Println("Hash:", hex.EncodeToString(h)) + fmt.Printf( + "Encoded: $balloon$h=sha512,s=%d,t=%d,p=%d$%s$%s\n", + *s, *t, *p, + base64.RawStdEncoding.EncodeToString(salt), + base64.RawStdEncoding.EncodeToString(h), + ) }