Rolling hash, which method to use?

Revision en1, by qwi, 2021-08-16 20:06:18

Recently, I have been reading up on few blogs about rolling hashes: dacin21's [On the mathematics behind rolling hashes and anti-hash tests] and rng_58's [Hashing and Probability of Collision]. Both of them showcase different hashing technique.

Method described in dacin21's blog:

Note: in the above equation a is the base

Method described in rng_58's blog: H(a) = (r+a_1)(r+a_2)...(r+a_n)

Note: in the above equation r is the base

Are there any differences between the two in terms of use-case and other parameters?

Tags rolling hashes, string hash

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English qwi 2021-08-16 20:11:16 200 Tiny change: 'lling hashes: dacin21'' -> 'lling hash: dacin21'' (published)
en1 English qwi 2021-08-16 20:06:18 780 Initial revision (saved to drafts)