Export to GitHub

crypto-js - issue #93

Base64 encoding of hash identical to hex encoding


Posted on Aug 25, 2013 by Quick Giraffe

What steps will reproduce the problem? 1. I used the hmac-sha256.js rollup 2. generated a hash using CryptoJS.HmacSHA256 3. I used hash.toString(<enc>) to convert to various output formats and saw that base64 is the same as hex

What is the expected output? What do you see instead? signature(b64): e6393a027f16e62a63f709e85c882d1ec2864b96ed659600dc4f65b23e1f0d5c signature(latin): æ9:æ*c÷ è\ˆ-†K–íe–�ÜOe²> \ signature(hex): e6393a027f16e62a63f709e85c882d1ec2864b96ed659600dc4f65b23e1f0d5c

What version of the product are you using? On what operating system? I'm running in FF23 on OS X

Please provide any additional information below.

Comment #1

Posted on Aug 25, 2013 by Happy Horse

Most likely it's because the enc-base64.js script wasn't loaded, which means CryptoJS.enc.Base64 will be undefined.

Comment #2

Posted on Aug 25, 2013 by Quick Giraffe

Thanks! I included enc-base64.js and it works fine.

Comment #3

Posted on Aug 25, 2013 by Happy Horse

(No comment was entered for this change.)

Status: Invalid

Labels:
Type-Defect Priority-Medium