-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
128-bit and 256-bit variants of "ASM hashes" #1
Comments
6 out of the 10 algorithms produce 128-bit hashes. The ones that don't would be significantly slower if they needed to produce larger hash values. The AVX variants could naturally support 256 bit hashes with a little bit of work. |
For reference this is why I suggested the idea Cyan4973/xxHash#257 |
SSEHash, SSEHash2, CLMHash, AVXHash, AVXHash2 and AESHash all produce 128-bit hashes. I've just added MLXHash2 and AVXHash3 which both produce 256-bit hashes. Despite producing a larger hash AVXHash3 is also the fastest algorithm in the suite. It would be trivial to provide variants of the other algorithms so they also produce 256-bit hashes but they wouldn't be as fast. I'm sure 512-bit or even 1024-bit would be possible too. |
Thanks for the help, also there are some questions I would like to raise:
|
SSE and AVX are vectorised instructions. You can do the same operations as with general purpose registers but instead do multiple operations in parallel. For example a 128-bit SSE register allows 8 parallel 16-bit operations or 4 parallel 32-bit operations or 2 parallel 64-bit operations. AVX allows double that. The algorithms here make use of 16-bit and 32-bit multiplication so could be considered smaller integer operations. The MLX and CLM algorithms both utilise the multiplication of two 64-bit numbers into a 128-bit result so they could be considered bigger integer operations. You could use AES-NI as the mixing function for a hash algorithm that produces hashes of any size. It's just a matter of mixing between the AES-NI registers. Grostl is based on the same primitives as AES but uses wider arrays than is supported by the AES-NI instructions. SHAvite-3 (as far as I can tell) uses standard AES rounds on concurrent streams and then mixes across them in a particular order. ECHO is like AES squared where it uses an AES like array structure but each element in the array is an AES structure itself. |
64 bits of hash is too small for large amounts of data, due to hash collisions being more common. It would be great if there are longer options.
The text was updated successfully, but these errors were encountered: