SIMD-accelerated bitwise hamming distance Python module for hexidecimal strings
SIMD-accelerated bitwise hamming distance Python module for hexidecimal strings What does it do? This module performs a fast bitwise hamming distance of two hexadecimal strings. This looks like: DEADBEEF = 11011110101011011011111011101111 00000000 = 00000000000000000000000000000000 XOR = 11011110101011011011111011101111 Hamming = number of ones in DEADBEEF ^ 00000000 = 24 This essentially amounts to >>> import gmpy >>> gmpy.popcount(0xdeadbeef ^ 0x00000000) 24 except with Python strings, so >>> import gmpy >>> gmpy.popcount(int(“deadbeef”, 16) ^ int(“00000000”, 16)) 24 A few assumptions are made […]
Read more