Created
September 1, 2016 13:03
-
-
Save ahmdrz/ae0c222b54fc2a7c620c7084257ffe85 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/hmac" | |
"crypto/sha256" | |
"fmt" | |
) | |
func CheckMAC(message, messageMAC, key []byte) bool { | |
mac := hmac.New(sha256.New, key) | |
mac.Write(message) | |
expectedMAC := mac.Sum(nil) | |
return hmac.Equal(messageMAC, expectedMAC) | |
} | |
func main() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment