hash-prospector
hash-prospector copied to clipboard
added byte shuffle, CRC32c, carryless multiplication, and xor-rotate
This pull request adds a byte shuffle shf
to hash prospector for 32-bit as well as 64-bit hashing functions.
It relies on SSSE3's pshufb
instruction and only works on corresponding hardware which should comprise most recent Intel/AMD CPUs. All related additions to the code are guarded by #ifdef
s.
-p
-provided patterns can use shf
or shf:<perm>
where <perm>
denotes a permutation of the byte positions. In 32-bit mode, shf:03020100
describes identity, i.e. no change of position, and shf:00010203
equals an endianess changing byte swap. In 64-bit mode (-8
), those permutations need to be longer, e.g. shf:0605040302010007
corresponding to an 8-bit left rotate. A sole shf
employs a randomly generated permutation.
Some additional thoughts especially on 32-bit byte shuffle and their implementation can be found here.
Fixes #7. Fixes #14. Fixes #17.