Created
June 14, 2023 23:22
-
-
Save nuvious/a5bfd1cbae037af5acbd5ffba1be4d23 to your computer and use it in GitHub Desktop.
A meme sha
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
""" | |
sha1 and md5 are both known to have collision attacks where an malicious | |
actor can craft a file with the same hash to inject code or modify | |
configurations unnoticed. The means integrity checking with only sha1 and | |
md5 are a bad idea, but good luck to any attacker trying to make a collision | |
for 2 algorithms at the same time! This is the meme implementation of that | |
as a lambda function for the lol. | |
""" | |
from hashlib import md5, sha1 | |
mdsha1 = lambda x: sha1(x).digest() + md5(x).digest() | |
if __name__ == "__main__": | |
print( | |
mdsha1( | |
b"good luck crafting a collision for SHA1 and MD5 at the same time!" | |
).hex() | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment