From cbc0a16ea659ae5e045a8c94f0ce862bf7065b5e Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 23 Mar 2025 12:03:21 +0800 Subject: Separate privkey stuff --- privkey.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 privkey.go (limited to 'privkey.go') 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) +} -- cgit v1.2.3