hapi-ton-sdk
Version:
SDK for managing HAPI attestations on TON network
20 lines • 448 B
JavaScript
// src/utils/crc32.ts
function crc32(str) {
const table = new Int32Array(256);
for (let i = 0; i < 256; i++) {
let c = i;
for (let j = 0; j < 8; j++) {
c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
}
table[i] = c;
}
let crc = -1;
for (let i = 0; i < str.length; i++) {
crc = crc >>> 8 ^ table[(crc ^ str.charCodeAt(i)) & 255];
}
return (crc ^ -1) >>> 0;
}
export {
crc32
};
//# sourceMappingURL=crc32.mjs.map