brix / crypto-js

JavaScript library of crypto standards.
Other
15.82k stars 2.39k forks source link

CryptoJS.enc.Base64.parse can work on not base64 #244

Open zengzhengrong opened 4 years ago

zengzhengrong commented 4 years ago
const key = Crypto.enc.Base64.parse('my-key-cipher');
const iv = Crypto.enc.Base64.parse('my-iv-cipher');

const encrypted = CryptoJS.AES.encrypt(password,key,{iv:iv});
const c_text = encrypted.ciphertext.toString(CryptoJS.enc.Base64);

my-key-cipher look like:5b8e151628dea2a6abf7158809cf4f3c my-iv-cipher look like:3ad77bb40d7a3660a89face32466ef79 It's hexdex not base64 ,but there are work fine ,make me confusion I review docs find API that:

var words = CryptoJS.enc.Base64.parse("SGVsbG8sIFdvcmxkIQ==");

I want to make the same cipher text by another side

issues :encrypt

emmansun commented 6 months ago

This should be related to the definition order of enc.Base64 and lib.Cipher, we can resolve this issue by changing the packaged files order.