Python implementation, modify array hashing method to be cross compatible.