hashmap - 在C++中,如何对中文的字符串做哈希映射,使得所产生的冲突尽可能的少?
阿神
阿神 2017-04-17 11:24:36
0
2
570

都是一些十个汉字以内的字符串,如何设置哈希函数呢?

阿神
阿神

闭关修行中......

reply all(2)
小葫芦

I personally recommend two articles:
https://www.byvoid.com/blog/string-hash-compare
http://blog.csdn.net/icefireelf/article/details/5796529
Can you treat a Chinese character (wide character) as several ASCII characters and apply these algorithms?

大家讲道理

Ten Chinese characters, if encoded in GB2312, are 20 bytes. If you directly use these 20 bytes as a "Hash value", there will be no conflict.
By the way, the length of SHA1 is also 160bit, which is 20 bytes. SHA512 is even longer, so it’s better not to use it

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template