Repository navigation
Expand file tree
/
Copy pathindex.js
More file actions
79 lines (69 loc) · 2.33 KB
/
Copy pathindex.js
File metadata and controls
79 lines (69 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**
* blake3-bao - Pure JavaScript BLAKE3 and Bao implementation
*
* Re-exports everything from blake3.js and bao.js for convenient access.
*/
'use strict';
const blake3 = require('./blake3.js');
const bao = require('./bao.js');
// Re-export blake3 functions
exports.hash = blake3.hash;
exports.hashHex = blake3.hashHex;
exports.toHex = blake3.toHex;
exports.initSimd = blake3.initSimd;
exports.isSimdEnabled = blake3.isSimdEnabled;
exports.createHasher = blake3.createHasher;
exports.createKeyedHasher = blake3.createKeyedHasher;
exports.hashKeyed = blake3.hashKeyed;
exports.deriveKey = blake3.deriveKey;
exports.Hasher = blake3.Hasher;
// Re-export bao functions
exports.baoEncode = bao.baoEncode;
exports.baoDecode = bao.baoDecode;
exports.baoSlice = bao.baoSlice;
exports.baoDecodeSlice = bao.baoDecodeSlice;
exports.BaoEncoder = bao.BaoEncoder;
exports.BaoDecoder = bao.BaoDecoder;
// Iroh chunk group support
exports.baoEncodeIroh = bao.baoEncodeIroh;
exports.baoDecodeIroh = bao.baoDecodeIroh;
exports.baoVerifyIroh = bao.baoVerifyIroh;
exports.chunkGroupCV = bao.chunkGroupCV;
exports.countChunkGroups = bao.countChunkGroups;
exports.irohOutboardSize = bao.irohOutboardSize;
// Partial/Resumable downloads
exports.PartialBao = bao.PartialBao;
exports.createBitfield = bao.createBitfield;
exports.setBit = bao.setBit;
exports.clearBit = bao.clearBit;
exports.getBit = bao.getBit;
exports.countSetBits = bao.countSetBits;
// Hash sequences (blob collections)
exports.HashSequence = bao.HashSequence;
// Named sub-modules
exports.blake3 = blake3;
exports.bao = bao;
// WASM-accelerated modules (optional)
// These provide faster Bao operations for large files
try {
exports.baoWasm = require('./bao-wasm.js');
exports.baoWasmZerocopy = require('./bao-wasm-zerocopy.js');
} catch (e) {
// WASM modules are optional - may not be available in all environments
exports.baoWasm = null;
exports.baoWasmZerocopy = null;
}
// Rust WASM SIMD-accelerated module (optional)
// Uses official blake3 crate for 3x faster crypto operations
try {
exports.baoRustWasm = require('./bao-rust-wasm.js');
} catch (e) {
exports.baoRustWasm = null;
}
// Parallel Rust WASM with worker threads (optional)
// Scales across CPU cores for 1778+ MB/s throughput
try {
exports.baoRustParallel = require('./bao-rust-parallel.js');
} catch (e) {
exports.baoRustParallel = null;
}