Skip to content

AES Encrypt and decrypt from Hex #143

@andrepcg

Description

@andrepcg

What is wrong with the following piece of code?

var key = '123';
// Encrypt
var ciphertext = CryptoJS.AES.encrypt('my message', key);
var cypherString = ciphertext.toString(CryptoJS.format.Hex)

// Decrypt
var bytes  = CryptoJS.AES.decrypt(cypherString, key, {format: CryptoJS.format.Hex });
var plaintext = bytes.toString();

plaintext is always an empty string when it should output 'my message'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions