Fix Python 3 encoding issue

Must encode unicode string before passing to hashlib.md5 in Python 3.