blake3
Version:
BLAKE3 hashing for JavaScript: native Node bindings (where available) and WebAssembly
18 lines • 671 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const hash_fn_1 = require("../base/hash-fn");
const blake3_js_1 = require("../../dist/wasm/nodejs/blake3_js");
/**
* @hidden
*/
exports.normalizeInput = (input, encoding) => hash_fn_1.inputToArray(typeof input === 'string' ? Buffer.from(input, encoding) : input);
/**
* Returns a blake3 hash of the input, returning the binary hash data.
*/
function hash(input, { length = hash_fn_1.defaultHashLength } = {}) {
const result = Buffer.alloc(length);
blake3_js_1.hash(exports.normalizeInput(input), result);
return result;
}
exports.hash = hash;
//# sourceMappingURL=hash-fn.js.map
;