diff options
Diffstat (limited to 'privkey.go')
-rw-r--r-- | privkey.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/privkey.go b/privkey.go new file mode 100644 index 0000000..bad6f80 --- /dev/null +++ b/privkey.go @@ -0,0 +1,21 @@ +package main + +import ( + "crypto/rand" + "crypto/sha256" + "log" +) + +var ( + privkey = make([]byte, 32) + privkeyHash = make([]byte, 0, sha256.Size) +) + +func init() { + if _, err := rand.Read(privkey); err != nil { + log.Fatal(err) + } + h := sha256.New() + h.Write(privkey) + privkeyHash = h.Sum(nil) +} |