Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,894 questions

51,825 answers

573 users

How to create base64 hashes using HMAC SHA256 in JavaScript

1 Answer

0 votes
<!DOCTYPE html>
<html>
<head>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/hmac-sha256.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/enc-base64.min.js"></script>
</head>
const secretkey = "45fd2ds908hjcx";
const message = "javascript programming"

let hash = CryptoJS.HmacSHA256(message, secretkey);
var hashBase64 = CryptoJS.enc.Base64.stringify(hash);

console.log(hashBase64)



/*
run:

mIflD34A/M9cm7qS7Q5hn5+08d0rGT0cNxuy84lqp84=

*/

 



answered Aug 8, 2020 by avibootz
...