gpt4 book ai didi

algorithm - RS散列程序

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:54:21 27 4
gpt4 key购买 nike

谁能告诉我RS字符串哈希算法的工作原理或算法?我需要它,但在谷歌上找不到。请至少帮我解决算法问题,我会自己实现。

最佳答案

你是说Robert Sedgewick的字符串哈希算法?

uint a = 63689, uint b = 378551
foreach ( byte x ; bytes ) {
value = value * a + x;
a *= b;
}
return value;

(引自 http://pallas.telperion.info/d/hash/ )。

关于algorithm - RS散列程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6136964/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com