luci-base: cbi.js: fix sfh() signedness bug for strings with 3 trailing bytes
Replace a sign-propagating right shift by a zero-filling right shift to avoid calculating a wrong hash code in the three-trailing-bytes case. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
2babc47ae2
commit
c55436e36f
1 changed files with 1 additions and 1 deletions
|
@ -60,7 +60,7 @@ function sfh(s) {
|
|||
hash += ((bytes[off + 1] << 8) + bytes[off]) >>> 0;
|
||||
hash = (hash ^ (hash << 16)) >>> 0;
|
||||
hash = (hash ^ (bytes[off + 2] << 18)) >>> 0;
|
||||
hash += hash >> 11;
|
||||
hash += hash >>> 11;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
|
Loading…
Reference in a new issue