Murmur3 hash different result between Python and Java implementation

前端 未结 2 1245
北荒
北荒 2021-01-14 14:04

I have two different program that wish to hash same string using Murmur3 in Python and Java respectively.

Python version 2.7.9:



        
2条回答
  •  野的像风
    2021-01-14 14:45

    If anyone is interested in the reverse answer, converting the python output to the Java output:

    import mmh3
    import string
    
    char_array = '0123456789abcdef'
    mumrmur = mmh3.hash_bytes('abc')
    
    result = [f'{string.hexdigits[(char >> 4) & 0xf]}{string.hexdigits[char & 0xf]}' for char in mumrmur]
    print(''.join(result))
    

提交回复
热议问题