Created
May 14, 2021 03:00
-
-
Save markddavidoff/01a76d6f3c42d7497d6be4faa59cbfcb to your computer and use it in GitHub Desktop.
hmac key collision
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
import hashlib | |
import hmac | |
string1 = 'plnlrtfpijpuhqylxbgqiiyipieyxvfsavzgxbbcfusqkozwpngsyejqlmjsytrmd' | |
string2 = 'eBkXQTfuBqp\'cTcar&g*' | |
key1 = hashlib.pbkdf2_hmac('sha1', string1.encode(), b'salt', 100000) | |
key2 = hashlib.pbkdf2_hmac('sha1', string2.encode(), b'salt', 100000) | |
hmac.new(key1, b"test", hashlib.sha256).hexdigest() | |
# '8122f91c70f4ac2205fc2039fc27bac3d54ccd91ee5ebf8d58fe13b406abd34a' | |
hmac.new(key2, b"test", hashlib.sha256).hexdigest() | |
# '8122f91c70f4ac2205fc2039fc27bac3d54ccd91ee5ebf8d58fe13b406abd34a' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment