Changes to make hashing mechanism consistent with Python version.