Release Archive Tools 0.1.0

This commit is contained in:
2026-09-01 02:42:42 +02:00
commit a49ec6b17a
77 changed files with 11528 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
const table = (() => {
const values = new Uint32Array(256);
for (let index = 0; index < values.length; index += 1) {
let value = index;
for (let bit = 0; bit < 8; bit += 1)
value = value & 1 ? 0xedb88320 ^ (value >>> 1) : value >>> 1;
values[index] = value >>> 0;
}
return values;
})();
export function crc32(bytes: Uint8Array): number {
let value = 0xffffffff;
for (const byte of bytes)
value = table[(value ^ byte) & 0xff]! ^ (value >>> 8);
return (value ^ 0xffffffff) >>> 0;
}
export function crc32Hex(bytes: Uint8Array): string {
return crc32(bytes).toString(16).padStart(8, "0");
}
export function uint32Hex(value: number): string {
return (value >>> 0).toString(16).padStart(8, "0");
}