#
# hashpjw, algorithm by P.J.Weinberg
#
# implemented by Michael Neumann
#

def hashpjw(txt, m=101)
   h = 0
   txt.each_byte {|i|
      h = (h << 4) + i
      g = h & 0xf0000000
      h ^= (g >> 24) ^ g if g
   }
   return h%m
end