当 base 为偶数时,随便造一个长度 >64 的字符串,只要它们后 64 位相同那么俩字符串的哈希值就相同,直接就卡掉了。
当 base 为奇数时,对于一个只有 a 和 b 组成的字符串 s ,我们定义 \bar{s} 为将 s 中所有 a 变为 \mathrm{b}, ~ \mathrm{~b} 变为 a 的结果。
然后我们构造 s_{1}=" \mathrm{a} ", s_{i}=s_{i-1}+\overline{s_{i-1}} ,再定义 \operatorname{hash}(s) 为字符串 s 的哈希值。那么显然有
\operatorname{hash}\left(s_{i}\right)=\operatorname{hash}\left(s_{i-1}\right) \times b a s e^{2^{i-2}}+\operatorname{hash}\left(\overline{s_{i-1}}\right)\operatorname{hash}\left(\overline{s_{i}}\right)=\operatorname{hash}\left(\overline{s_{i-1}}\right) \times b a s e^{2^{i-2}}+\operatorname{hash}\left(s_{i-1}\right)