CryptoJS and Crypto (nodejs) won't generate the same HMAC SHA256 hash

A third party API provider requires a signature to be sent in the headers. They have have shared They gave us a working example in Postman. In the example they do a Hmac SHA256 encoded in base64 + UTF8. For that they use CryptoJS. However, I need to use crypto (nodejs library) due to some… Read More CryptoJS and Crypto (nodejs) won't generate the same HMAC SHA256 hash

Im trying to encrypt a string in javascript but it returns different strings

I’m trying to create a script that encrypts strings, here’s my code: <!DOCTYPE html> <html lang="nl"> <head> <link rel="stylesheet" type="text/css" href="/denoryplay3/css/style.css"> <title>Encryption</title> </head> <body> <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js&quot; integrity="sha256-/H4YS+7aYb9kJ5OKhFYPUjSJdrtV6AeyJOtTkw6X72o=" crossorigin="anonymous"></script> <script> function encrypt(data, key){ return CryptoJS.AES.encrypt(data, key); } function decrypt(data, key){ return CryptoJS.AES.decrypt(data, key); } </script> </body> </html> And i tried running this code: alert(decrypt(encrypt("hi", "12345"), ‘12345’));… Read More Im trying to encrypt a string in javascript but it returns different strings

Trying to print hex string with CryptoJS

I am trying to use CryptoJS to encrypt something and then generate a hexadecimal string of the encrypted text. function EncryptAES(text, key) { var encrypted = CryptoJS.AES.encrypt(text, key); return CryptoJS.enc.Hex.stringify(encrypted); } var encrypted = EncryptAES("Hello, World!", "SuperSecretPassword"); console.log(encrypted); However, instead of a hexadecimal string, a blank line is printed to the console. What am I… Read More Trying to print hex string with CryptoJS