Home > Software engineering >  Is it possible to replace 32 bit hash function with 64 bit in this case?
Is it possible to replace 32 bit hash function with 64 bit in this case?

Time:09-17

I've found https://github.com/cespare/mph as a minimal perfect hash, but it seems that it uses 32 bit function (I want 64 one). Is there a way to replace the function and make it work along with the rest part of the code?

CodePudding user response:

Yes. The steps are:

  1. Read the paper and understand it.
  2. Read the code and understand it.
  3. Make the necessary changes.

There's nothing in the algorithm that depends on a specific hash output size, so you can change it to anything you want, as long as the hash family you supply meets the requirements of section 1.3.

Probably it just requires changing all of the uint32 to uint64 in mph.go, and replacing all of murmur.go with a new 64-bit implementation; you just have to make sure that that new 64-bit hash is good.

  • Related