Why md5 hash of a word from a file doesn't match the hash of a string?
问题 I'm trying to create a python program that would read words from a dictionary, create a md5 hash and compare it to a given hash. Everything works fine when I try to compare two hashes of words that haven't been read from a file: if hashlib.md5(b"string").hexdigest() == "b45cffe084dd3d20d928bee85e7b0f21": print("Equal!") But when I read the words line by line from a file, the hash of the word is different. The code looks like this: f = open('short.txt', 'r') stringHash =