into GitHub is not clear because i must use a second argument ( in this case "secretKey
" ) for crypting or decrypting :
//Encrypt
var encryptedMessage = crypto.AES.encrypt(secretMessage, secretKey);
console.log("Encrypted message " + encryptedMessage);
//Decrypted
var bytes = crypto.AES.decrypt(encryptedMessage, secretKey);
var decryptedMessage = bytes.toString(crypto.enc.Utf8); // convert into string and encoding Utf8
If i compile without the second argument, Node responde that property "words" is undefined. Why? Thanks all Morris
Are you asking why you have to use a secret key for decryption? That's a trivial requirement for having an actually secure implementation for encryption. If your encrypted message could be decrypted WITHOUT using the secret key, then every single person on the planet earth can decrypt your message.
I'm pretty sure you're not asking that, but I don't know what you're asking anyway and looking at your question, that's the closest thing to what you're asking.