@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
46 lines • 1.78 kB
TypeScript
export declare function sha256Hex(bytes: Uint8Array): Promise<string>;
export declare function sha1Hex(bytes: Uint8Array): Promise<string>;
/**
* The 8-byte SHA-1 length trailer: the message length in bits, big-endian
* across 64 bits. Split into high and low words, since the bit length passes
* 32 bits at 512 MiB and a 32-bit shift would wrap it. Exported so its test
* can cross that boundary without hashing 512 MiB.
*/
export declare function sha1LengthTrailer(byteLength: number): Uint8Array;
/**
* Incremental SHA-1, for bytes that arrive in chunks. WebCrypto hashes only
* a whole buffer, and a stream cannot be buffered whole to hash at the end:
* drains are bounded, so the copy would be unbounded and never cached. The
* partial block a chunk leaves is carried into the next `update`; padding
* happens only in `digest`.
*/
export declare class Sha1 {
private readonly state;
private readonly block;
private readonly words;
private filled;
private length;
update(chunk: Uint8Array): void;
digest(): string;
private compress;
}
/**
* Incremental MD5, for bytes that arrive in chunks, as `Sha1` is for SHA-1.
* Pure JS: WebCrypto has no MD5, and core cannot import node:crypto. The
* partial block a chunk leaves is carried into the next `update`; padding
* happens only in `digest`.
*/
export declare class Md5 {
private readonly state;
private readonly block;
private readonly blockView;
private readonly words;
private filled;
private length;
update(chunk: Uint8Array): void;
digest(): string;
private compress;
}
export declare function md5Hex(bytes: Uint8Array): string;
export declare function md5HexAsync(bytes: Uint8Array): Promise<string>;
//# sourceMappingURL=hash.d.ts.map