@huggingface/xetchunk-wasm
Advanced tools
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"hash-utils.d.ts","sourceRoot":"","sources":["../../src/hash-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAa9C;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAGpD;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,UAAU,CAElE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,CAMtE"} | ||
| {"version":3,"file":"hash-utils.d.ts","sourceRoot":"","sources":["../../src/hash-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAa9C;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAUpD;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,UAAU,CAElE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,CAMtE"} |
@@ -22,2 +22,9 @@ "use strict"; | ||
| function fileHash(chunks) { | ||
| // Empty input short-circuits to the all-zero MerkleHash, matching Rust's | ||
| // `file_hash_with_salt` (`if chunks.is_empty() { return MerkleHash::default(); }`). | ||
| // Without this we'd return `hmac(0, zero_key)`, which the CAS shard validation rejects | ||
| // for empty files with "file reconstruction does not produce this hash". | ||
| if (chunks.length === 0) { | ||
| return new Uint8Array(32); | ||
| } | ||
| const xorb = (0, xorb_hash_js_1.xorbHash)(chunks); | ||
@@ -24,0 +31,0 @@ return fileHasher.reset().update(xorb).finalize(32); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"hash-utils.d.ts","sourceRoot":"","sources":["../../src/hash-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAa9C;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAGpD;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,UAAU,CAElE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,CAMtE"} | ||
| {"version":3,"file":"hash-utils.d.ts","sourceRoot":"","sources":["../../src/hash-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAa9C;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAUpD;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,UAAU,CAElE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,CAMtE"} |
@@ -17,2 +17,9 @@ import { Hasher } from "@huggingface/blake3-jit"; | ||
| export function fileHash(chunks) { | ||
| // Empty input short-circuits to the all-zero MerkleHash, matching Rust's | ||
| // `file_hash_with_salt` (`if chunks.is_empty() { return MerkleHash::default(); }`). | ||
| // Without this we'd return `hmac(0, zero_key)`, which the CAS shard validation rejects | ||
| // for empty files with "file reconstruction does not produce this hash". | ||
| if (chunks.length === 0) { | ||
| return new Uint8Array(32); | ||
| } | ||
| const xorb = xorbHash(chunks); | ||
@@ -19,0 +26,0 @@ return fileHasher.reset().update(xorb).finalize(32); |
+1
-1
| { | ||
| "name": "@huggingface/xetchunk-wasm", | ||
| "version": "0.0.6", | ||
| "version": "0.1.0", | ||
| "description": "Content-defined chunking and hashing for Hugging Face Xet storage", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -22,2 +22,9 @@ import { Hasher } from "@huggingface/blake3-jit"; | ||
| export function fileHash(chunks: Chunk[]): Uint8Array { | ||
| // Empty input short-circuits to the all-zero MerkleHash, matching Rust's | ||
| // `file_hash_with_salt` (`if chunks.is_empty() { return MerkleHash::default(); }`). | ||
| // Without this we'd return `hmac(0, zero_key)`, which the CAS shard validation rejects | ||
| // for empty files with "file reconstruction does not produce this hash". | ||
| if (chunks.length === 0) { | ||
| return new Uint8Array(32); | ||
| } | ||
| const xorb = xorbHash(chunks); | ||
@@ -24,0 +31,0 @@ return fileHasher.reset().update(xorb).finalize(32); |
52687
2.34%1103
1.94%