mirror of
https://github.com/JonasunderscoreJones/api.jonasjones.dev.git
synced 2025-10-23 20:19:19 +02:00
Initial commit (by create-cloudflare CLI)
This commit is contained in:
commit
58a42872a0
1745 changed files with 741893 additions and 0 deletions
26
node_modules/blake3-wasm/esm/node-native/hash-instance.js
generated
vendored
Normal file
26
node_modules/blake3-wasm/esm/node-native/hash-instance.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import native from './native.js';
|
||||
import { NodeHash } from '../node/hash-instance.js';
|
||||
import { NodeHashReader } from '../node/hash-reader.js';
|
||||
// A buffer we reuse for sending bigints. set_position is synchronous, so
|
||||
// this just saves creating garbage.
|
||||
const bigIntBuffer = Buffer.alloc(8);
|
||||
const readerFactory = (r) => new NodeHashReader({
|
||||
fill: target => r.fill(target),
|
||||
set_position: position => {
|
||||
bigIntBuffer.writeBigUInt64BE(position);
|
||||
r.set_position(bigIntBuffer);
|
||||
},
|
||||
});
|
||||
/**
|
||||
* A Node.js crypto-like createHash method.
|
||||
*/
|
||||
export const createHash = () => new NodeHash(new native.Hasher(), readerFactory);
|
||||
/**
|
||||
* Construct a new Hasher for the keyed hash function.
|
||||
*/
|
||||
export const createKeyed = (key) => new NodeHash(new native.Hasher(key), readerFactory);
|
||||
/**
|
||||
* Construct a new Hasher for the key derivation function.
|
||||
*/
|
||||
export const createDeriveKey = (context) => new NodeHash(new native.Hasher(undefined, context), readerFactory);
|
||||
//# sourceMappingURL=hash-instance.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue