Good morning, So, I created a MD5 hash from a TXT file. After changing the file content inserting new values, I tried to create a MD5 hash again, but the value didn't change. What could I do?
My code:
from hashlib import md5
open_file = open('N0003966.290', 'r', encoding='ISO-8859-1')
file = open_file.read().lower().rstrip('\n\r ').strip('\n\r')
m = md5()
m.update(b'file')
print(m.hexdigest())
I need to follow some requirements to build this hash, such as:
- The encoding rule must be 'ISO-8859-1'
- All the characters must be lowercase
- New line characters and carriage return characters must NOT be considered on hash building