Created
July 6, 2015 16:43
-
-
Save st/d52ae86b8ddb83a6f6b4 to your computer and use it in GitHub Desktop.
hmac verify with String signature
This file contains 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
(-> (hmac/hash "foo bar" "mysecretkey" :sha256) | |
(codecs/bytes->hex)) | |
=> "61849448bdbb67b39d609471eead667e65b0d1b9e01b1c3bf7aa56b83e9c8083" | |
;; so far, so good | |
(hmac/verify "foo bar" "61849448bdbb67b39d609471eead667e65b0d1b9e01b1c3bf7aa56b83e9c8083" "mysecretkey" :sha256) | |
=> false | |
;; should be true, no? | |
(def bytes-hash (hmac/hash "foo bar" "mysecretkey" :sha256)) | |
=> #'user/bytes-hash | |
(hmac/verify "foo bar" bytes-hash "mysecretkey" :sha256) | |
=> true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment