Rocky_Mountain_Vending/.pnpm-store/v10/files/8b/94cb8dc3be63eba0c2e2914d77c9e8fb6452c3c9d50dc3030f5c9849c4101dde336ca06f2f0ed59ddae97694311989c3bb930651d83700f89bd77a008d32d0
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

43 lines
No EOL
1.4 KiB
Text

import native from './native.js';
import { defaultHashLength } from '../base/hash-fn.js';
/**
* @hidden
*/
export const normalizeInput = (input, encoding) => {
if (input instanceof Buffer) {
return input;
}
if (typeof input === 'string') {
return Buffer.from(input, encoding);
}
return Buffer.from(input);
};
/**
* Returns a blake3 hash of the input, returning the binary hash data.
*/
export function hash(input, { length = defaultHashLength } = {}) {
return native.hash(normalizeInput(input), length);
}
/**
* Given cryptographic key material and a context string, services a subkey of
* any length. See {@link https://docs.rs/blake3/0.1.3/blake3/fn.derive_key.html}
* for more information.
*/
export function deriveKey(context, material, { length = defaultHashLength } = {}) {
const hasher = new native.Hasher(undefined, context);
hasher.update(normalizeInput(material));
const result = Buffer.alloc(length);
hasher.digest(result);
return result;
}
/**
* The keyed hash function. See {@link https://docs.rs/blake3/0.1.3/blake3/fn.keyed_hash.html}.
*/
export function keyedHash(key, input, { length = defaultHashLength } = {}) {
const hasher = new native.Hasher(key);
hasher.update(normalizeInput(input));
const result = Buffer.alloc(length);
hasher.digest(result);
return result;
}
//# sourceMappingURL=hash-fn.js.map