Enhancement proposal: add mp_int hash function
urazoff opened this issue · 2 comments
It would be good to add a function to calculate the hash of the mp_int struct. A possible use case is to use mp_int as a key in a hash table.
As already discussed via mail I think having to implement this outside of the library would be a bit cumbersome and performance wise really bad and therefor we could add it to the library.
If we go for it, I'd propose to use FNV-1a [1] as hash function, but I'm open to other suggestions ... it could even be configurable... The reference implementation of FNV [2] is available in the public domain, so it can be integrated in ltm.
[1] https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
[2] http://isthe.com/chongo/tech/comp/fnv/#FNV-reference-source