diff --git a/incremental/common/src/sha1.ts b/incremental/common/src/sha1.ts index 189be4764055abadf736b59c2ee66874c16aac40..ad4ec9bfdec31d858431071cd89cc98503d96402 100644 --- a/incremental/common/src/sha1.ts +++ b/incremental/common/src/sha1.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import { CustomTextDecoder, float64toInt32 } from "@koalaui/compat" +import { CustomTextDecoder, float64toInt32, int64to32 } from "@koalaui/compat" import { int32 } from "@koalaui/compat" const K = [ @@ -180,7 +180,7 @@ export class SHA1Hash { _byte[index++] = 0x80 | (code & 0x3F) surrogate = 0 } else { - surrogate = code + surrogate = int64to32(code) } } diff --git a/incremental/common/src/stringUtils.ts b/incremental/common/src/stringUtils.ts index f92507d69bd92291e3d45fcff2f364264d294f53..439460fe08088b7b9ee27de5e2716194b99b490e 100644 --- a/incremental/common/src/stringUtils.ts +++ b/incremental/common/src/stringUtils.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import { int32, float64toInt32 } from "@koalaui/compat" +import { float64toInt32, int32, int64to32 } from "@koalaui/compat" /** @@ -22,8 +22,7 @@ import { int32, float64toInt32 } from "@koalaui/compat" export function hashCodeFromString(value: string): int32 { let hash = 5381 for(let i = 0; i < value.length; i++) { - hash = (hash * 33) ^ float64toInt32(value.charCodeAt(i)) - hash |= 0 + hash = int64to32((hash * 33) ^ float64toInt32(value.charCodeAt(i))) } return hash }