Created
January 22, 2015 17:03
-
-
Save ericchiang/8bd1fb904a37a46274b8 to your computer and use it in GitHub Desktop.
Why the do these return different values?
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/sha1" | |
"fmt" | |
) | |
func main() { | |
salt := []byte("nJ1m4Cc3") | |
hasher := hmac.New(sha1.New, salt) | |
fmt.Printf("%x\n", hasher.Sum(nil)) | |
// f7c0aebfb7db2c15f1945a6b7b5286d173df894d | |
} |
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
import hashlib | |
salt = "nJ1m4Cc3" | |
hasher = hashlib.new("sha1", salt) | |
print hasher.hexdigest() | |
# d67c1f445987c52bceb8d6475c30a8b0e9a3365d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment