diff --git a/single_file_tests/hmac.go b/single_file_tests/hmac.go new file mode 100644 index 0000000..fac7d13 --- /dev/null +++ b/single_file_tests/hmac.go @@ -0,0 +1,19 @@ +package main + +import ( + "crypto/hmac" + "crypto/sha1" + "encoding/base64" + "fmt" +) + +func main() { + key := []byte("aaaaaa") + mac := hmac.New(sha1.New, key) + mac.Write([]byte("Hello World!")) + hmacSum := mac.Sum(nil) + + fmt.Printf("%x\n", hmacSum) + fmt.Printf("%s\n", base64.StdEncoding.EncodeToString(hmacSum)) +} +