Hash function: Hash key (name of data object) into XY coordinate
Dear everyone, I'm trying to the find the hash function which can hash the key ( in string value) into XY coordinate. For example: H("Doraemon") = (1.2345 , 3.2345)
If you have any inf开发者_高级运维ormation about this: algorithm , source code in C++ ... or something like that. Please share for me.
Thanks for your help.
Get the SHA-1 or MD5 hash, as bits, and take half of them for X, half for Y. Of each half, use as many bits (big-endian) as you can, for example use the first 64 bits of each half (out of 80) and there you have a double value.
精彩评论