var crypto = require (' crypto '); function decode (Cryptkey, IV, Secretdata) { var decipher = crypto.createdecipheriv (' AES-256-CBC ', Cryptkey, iv), decoded = Decipher.update (Secretdata, ' base64 ') , ' UTF8 '); decoded + = decipher.final (' UTF8 '); return decoded;} function encode (Cryptkey, IV, ClearData) {var encipher = Crypto.createcipheriv (' AES-256-CBC ', Cryptkey, iv), ENC Oded = Encipher.update (cleardata, ' utf8 ', ' base64 '); encoded + = encipher.final (' base64 '); return encoded;} Varcryptkey = Crypto.createhash (' sha256 '). Update (' __tazai_wolf__key '). Digest (), iv = ' 1234567890000000 ', buf = "Talk: Create a room page." Click Creat. How did it not respond? ... ", enc = Encode (Cryptkey, IV, BUF); var dec = decode (Cryptkey, IV, ENC); function B64enc (data) {var b = new Buffer (data, ' binary '); Return b.tostring (' base64 ');} Console.warn ("Encoded length:", enc); Console.warn ("Decoded All:" + dec);
<?phpfunction decode ($cryptkey, $iv, $secretdata) { return Openssl_decrypt ($secretdata, ' AES-256-CBC ', $ Cryptkey,false, $IV);} function encode ($cryptkey, $iv, $secretdata) { return Openssl_encrypt ($secretdata, ' AES-256-CBC ', $cryptkey, False , $IV);} $cryptkey = hash (' sha256 ', ' __tazai_wolf__key ', true); $iv = ' 1234567890000000 '; $buf = "Hello World"; $enc = Encode ($ Cryptkey, $iv, $buf); $dec = Decode ($cryptkey, $iv, $enc); echo "encoded length:", $enc, "\ n"; echo "decoded all:", $dec, "\ n";
Nodejs Encrypted PHP decryption