Protype Candidate

This commit is contained in:
Ian Gulliver
2023-05-31 22:40:48 -07:00
parent 80c051183a
commit ef5323aa3f
3 changed files with 272 additions and 12 deletions

14
mac.go Normal file
View File

@@ -0,0 +1,14 @@
package elect
import (
"crypto/hmac"
"crypto/sha256"
"fmt"
)
func mac(payload, signingKey []byte) string {
gen := hmac.New(sha256.New, signingKey)
gen.Write(payload)
return fmt.Sprintf("%x", gen.Sum(nil))
}