18 lines
435 B
TypeScript
18 lines
435 B
TypeScript
import {
|
|
crc32 as sharedCrc32,
|
|
formatChecksum,
|
|
} from "@add-ideas/toolbox-helpers";
|
|
import { ARCHIVE_LIMITS } from "./limits";
|
|
|
|
export function crc32(bytes: Uint8Array): number {
|
|
return sharedCrc32(bytes, ARCHIVE_LIMITS.maxExpandedBytes);
|
|
}
|
|
|
|
export function crc32Hex(bytes: Uint8Array): string {
|
|
return formatChecksum(crc32(bytes));
|
|
}
|
|
|
|
export function uint32Hex(value: number): string {
|
|
return formatChecksum(value >>> 0);
|
|
}
|