From cb214daf358024d6ceaaa314cfddf0e59003e79b Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sat, 5 Oct 2019 11:47:15 +0300 Subject: [PATCH] Output also in encoded form --- cmd/balloon/main.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/balloon/main.go b/cmd/balloon/main.go index b7fd973..ba3be01 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" @@ -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), + ) } -- 2.44.0