python-farmhash
python-farmhash copied to clipboard
Support farmhash for bytes-like objects
In the current version,
- farmhash does not support
bytesin Python 3.
For example,farmhash.hash64(b'123')will lead toTypeError: argument 1 must be str, not bytes. - It does not support strings containing embedded nulls as well.
farmhash.hash64('\x00')will causeValueError: embedded null character.
This PR enables the functionality to deal with bytes-like objects and strings containing embedded nulls. After this PR is merged, we can call farmhash functions as follows without error.
farmhash.hash64('abc') # 2640714258260161385
farmhash.hash64(b'abc') # 2640714258260161385
farmhash.hash64('\x00') # 13718060045003475796
farmhash.hash64(b'\x00') # 13718060045003475796