UNPKG

micro-stacks

Version:

Tiny libraries for building Stacks apps.

9 lines (6 loc) 531 B
import { ensureUint8Array } from 'micro-stacks/common'; import { hmac } from '@noble/hashes/hmac'; import { sha256 } from '@noble/hashes/sha256'; import { sha512 } from '@noble/hashes/sha512'; function y(t,...o){let r=hmac.create(sha256,ensureUint8Array(t));for(let a of o)r.update(ensureUint8Array(a));return Uint8Array.from(r.digest())}function g(t,...o){let r=hmac.create(sha512,ensureUint8Array(t));for(let a of o)r.update(ensureUint8Array(a));return Uint8Array.from(r.digest())} export { y as hmacSha256, g as hmacSha512 };