MCPcopy Create free account
hub / github.com/TomClive/SeeDance2Stitcher / crc32

Function crc32

server.js:205–218  ·  view source on GitHub ↗
(buffer)

Source from the content-addressed store, hash-verified

203let crcTable;
204
205function crc32(buffer) {
206 if (!crcTable) {
207 crcTable = Array.from({ length: 256 }, (_, index) => {
208 let value = index;
209 for (let bit = 0; bit < 8; bit += 1) {
210 value = value & 1 ? 0xedb88320 ^ (value >>> 1) : value >>> 1;
211 }
212 return value >>> 0;
213 });
214 }
215 let crc = 0xffffffff;
216 for (const byte of buffer) crc = crcTable[(crc ^ byte) & 0xff] ^ (crc >>> 8);
217 return (crc ^ 0xffffffff) >>> 0;
218}
219
220function pngChunk(type, data = Buffer.alloc(0)) {
221 const typeBuffer = Buffer.from(type, "ascii");

Callers 1

pngChunkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected