Skip to content
Snippets Groups Projects
Unverified Commit 1450d444 authored by Angelo Capossele's avatar Angelo Capossele Committed by GitHub
Browse files

Write rand-seed output to a file (#774)

* :ambulance:  Write rand-seed output to a file

* :pencil2:  Fix review comments

* :beers: Address review comment
parent a2632bd4
Branches
No related tags found
No related merge requests found
*.txt
\ No newline at end of file
......@@ -4,6 +4,7 @@ import (
"crypto/rand"
"encoding/base64"
"fmt"
"os"
"github.com/mr-tron/base58"
)
......@@ -16,6 +17,16 @@ func main() {
return
}
fmt.Printf("base64:%s\n", base64.StdEncoding.EncodeToString(b))
fmt.Printf("base58:%s\n", base58.Encode(b))
// If the file doesn't exist, create it, or truncate the file
f, err := os.Create("random-seed.txt")
if err != nil {
fmt.Println(err)
return
}
defer f.Close()
f.WriteString("base64:" + base64.StdEncoding.EncodeToString(b) + "\n")
f.WriteString("base58:" + base58.Encode(b))
fmt.Println("New random seed generated (both base64 and base58 encoded) and written in random-seed.txt")
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment