@julesl23/s5js
Version:
Enhanced TypeScript SDK for S5 decentralized storage with path-based API, media processing, and directory utilities
21 lines • 678 B
JavaScript
///
/// This implementation follows the S5 v1 spec at https://docs.sfive.net/spec/key-derivation.html
///
import { encodeLittleEndian } from "./little_endian.js";
export function deriveHashString(base, tweak, crypto) {
if (base.length != 32) {
throw 'Invalid base length';
}
return crypto.hashBlake3Sync(new Uint8Array([
...base, ...crypto.hashBlake3Sync(tweak),
]));
}
export function deriveHashInt(base, tweak, crypto) {
if (base.length != 32) {
throw 'Invalid base length';
}
return crypto.hashBlake3Sync(new Uint8Array([
...base, ...encodeLittleEndian(tweak, 32),
]));
}
//# sourceMappingURL=derive_hash.js.map