If you’re looking for the equivalent of hash_hmac(‘sha1’, ‘string’, ‘secret’); in JavaScript, then here you go: async function hmac_sha1 (str, secret) { // see https://stackoverflow.com/a/47332317/1134119 let enc = new TextEncoder(“utf-8”); let key = await window.crypto.subtle.importKey( “raw”, // raw format of the key – should be Uint8Array enc.encode(secret), { // algorithm details name: “HMAC”, hash: {name: […]
Calculating HMAC SHA-1 in the Browser
- Post author By Aymeric
- Post date
- Categories In Astuce, English, Niveau expert, Programmation
- No Comments on Calculating HMAC SHA-1 in the Browser