Pot.Crypt.hashCode

{Number} Pot.Crypt.hashCode ({String|*} string)

Pot.js と PotLite.js で利用可能。

引数の値をハッシュ化します。

引数の文字列 string を 2^32 でハッシュします。
s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1] のように計算します。
java.lang.String.hashCode() と似ています。

Pot.globalize() が適応されている場合、Pot.hashCode() が hashCode() で実行できます。

ハッシュ化した数値が返ります。

Pot.debug( Pot.hashCode('abc') );         // 96354
Pot.debug( Pot.hashCode('foo bar baz') ); // 1892173108
Pot.debug( Pot.hashCode('ほげ') );        // 397111