Fix Python – Get MD5 hash of big files in Python

I have used hashlib (which replaces md5 in Python 2.6/3.0) and it worked fine if I opened a file and put its content in hashlib.md5() function.
The problem is with very big files that their sizes could exceed RAM size.
How to get the MD5 hash of a file without loading the whole file to memory?
….

Fix Python – How to correct TypeError: Unicode-objects must be encoded before hashing?

I have this error:
Traceback (most recent call last):
File “python_md5_cracker.py”, line 27, in
m.update(line)
TypeError: Unicode-objects must be encoded before hashing

when I try to execute this code in Python 3.2.2:
import hashlib, sys
m = hashlib.md5()
hash = “”
hash_file = input(“What is the file name in which the hash resides? ….