Convert 32-char md5 string to integer

后端 未结 5 692
情深已故
情深已故 2021-01-01 19:36

What\'s the most efficient way to convert an md5 hash to a unique integer to perform a modulus operation?

5条回答
  •  旧时难觅i
    2021-01-01 20:21

    You'll need to define your own hash function that converts an MD5 string into an integer of the desired width. If you want to interpret the MD5 hash as a plain string, you can try the FNV algorithm. It's pretty quick and fairly evenly distributed.

提交回复
热议问题