Answer the question
In order to leave comments, you need to log in
Aes-256-crt crypto not working?
There is code in PHP and JS to encrypt and decrypt using AES-256-CTR, PHP does a great job with both decryption and encryption, but JS returns an empty string. Why?
function encrypt ($text) {
return openssl_encrypt($text, "aes-256-ctr", "PASSWORD");
}
function decrypt ($crypt) {
return openssl_decrypt($crypt, "aes-256-ctr", "PASSWORD");
}
function decrypt(text) {
let decipher = crypto.createDecipher("aes-256-ctr", "PASSWORD");
let dec = decipher.update(text, "hex", "utf8");
dec += decipher.final("utf8");
return dec;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question