MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / crc32

Function crc32

packages/engine/src/utils/alphaBlit.test.ts:23–30  ·  view source on GitHub ↗
(data: Buffer)

Source from the content-addressed store, hash-verified

21}
22
23function crc32(data: Buffer): number {
24 let crc = 0xffffffff;
25 const table = crc32Table();
26 for (let i = 0; i < data.length; i++) {
27 crc = (table[(crc ^ (data[i] ?? 0)) & 0xff] ?? 0) ^ (crc >>> 8);
28 }
29 return (crc ^ 0xffffffff) >>> 0;
30}
31
32let _crcTable: Uint32Array | undefined;
33function crc32Table(): Uint32Array {

Callers 1

makeChunkFunction · 0.70

Calls 1

crc32TableFunction · 0.85

Tested by

no test coverage detected