hash = 0
for i=1 to len(s)
hash = hash * 2
hash = hash xor asc(s(i))
next i
こっちの方がいい。あと、オーバーフロー対策が必要