@knownasrazi/checksum
v1.0.0
Published
Streaming CRC32, MD5 and SHA-256 file and content checksums in pure TypeScript.
Maintainers
Readme
checksum
Streaming CRC32, MD5 and SHA-256 checksums.
Zero dependencies - ~2 KB gzipped - TypeScript - Node + Bun + browser
Install
bun add @knownasrazi/checksum
npm install @knownasrazi/checksumUsage
import { crc32, crc32Hex, sha256, md5, fileChecksum } from "@knownasrazi/checksum";
crc32("hello"); // number
crc32Hex("hello"); // "3610a686"
await sha256("abc"); // "ba7816bf8f01cfea414140de5dae2223b00361a39617..."
await md5("hello"); // "5d41402abc4b2a76b9719d911017c592"
const { crc32: c, sha256: s } = await fileChecksum(Bun.file("package.json"));API
| Export | Signature |
| --- | --- |
| crc32(input) | (string) => number pure impl |
| crc32Hex(input) | (string) => string 8-hex |
| sha256(input) | async (string) => string hex |
| md5(input) | async (string) => string hex |
| hash(input, algo) | async (string, "md5"|"sha256") => string |
| fileChecksum(file) | async (BunFile) => { crc32, sha256 } |
Development
git clone https://github.com/knownasrazi/checksum.git
cd checksum
bun install
bun test
bun run build
bun run lintLicense
checksum - hash without the ceremony.
