Skip to content

Instantly share code, notes, and snippets.

View guillermodlpa's full-sized avatar

Guillermo guillermodlpa

View GitHub Profile
@guillermodlpa
guillermodlpa / HMAC.js
Last active April 23, 2024 11:10 — forked from stevendesu/HMAC.js
A simple, open-source, HMAC-SHA256 implementation in pure TypeScript. Designed for efficient minification.
// From https://gist.github.com/stevendesu/2d52f7b5e1f1184af3b667c0b5e054b8
// To ensure cross-browser support even without a proper SubtleCrypto
// impelmentation (or without access to the impelmentation, as is the case with
// Chrome loaded over HTTP instead of HTTPS), this library can create SHA-256
// HMAC signatures using nothing but raw JavaScript
/* eslint-disable no-magic-numbers, id-length, no-param-reassign, new-cap */
// By giving internal functions names that we can mangle, future calls to