Replace built-in hash function with hashlib.

The built-in ```hash``` function returns inconsistent values in Python 3. I don't understand why. It may have something to do with the internal encoding of strings. Simply replacing ```hash(self.text)``` with ```hash(self.text.encode('utf-8'))``` does not fix the problem. Presumably any of the hash algorithms from hashlib could be used. I chose MD5 since there is no security issue here.