Note that there are some explanatory texts on larger screens.

plurals
  1. POAES Encryption in Nodejs does not work as it works in PHP
    text
    copied!<p><strong>NODE.JS CODE (DOES NOT WORK AS EXPECTED)</strong></p> <pre><code>var crypto = require('crypto'); var input = '200904281000001|DOM|IND|INR|10|orderno_unique1|others|http://localhost/sample/Success.php|http://localhost/sample/failure.php|TOML'; var Key = "qcAHa6tt8s0l5NN7UWPVAQ=="; Key = new Buffer(Key || '', 'base64'); var cipher = crypto.createCipher('aes128', Key); var actual = cipher.update(input, "utf8", "base64"); actual += cipher.final("base64"); console.log(actual); </code></pre> <p><strong>Actual Output</strong></p> <blockquote> <p>bIK4D0hv2jcKP3eikoaM7ddqRee+RrT2FDOZA+c2sldyrqP+NrmgYOEXklUrSBQiU7w7e90nzFl/mpidy/Q8FD692bFLnESiNqGEQ7er44BXxFtNo6AKvpuohz31zm9JupJXL3jhOC+47mvDHokR4b9euDzPFitTJQW55JuSyvJphOKdiXjH+lGKxXKWsODq</p> </blockquote> <p><strong>Expected Output</strong></p> <blockquote> <p>ncJ+HX6zIdrUfEedi7YC82QOUARkySblivzysFbMqaYEMPj7UfMlE4SEkDcjg+D9dE5StGJgebSOkL7UuR6fXwodcgL0CSRds0Y+hX27gKUZK45b7Tc0EjXhepwHJ/olSdWUCkwRcZcv+wxtYzOH7+KKijJabJkU1/SF1ugExzcnqfV2wOZ9q79a4y/g3cb5</p> </blockquote> <p><strong>PHP CODE (WORKS AS EXPECTED)</strong></p> <pre><code>include('CryptAES.php'); //Testing key $Key = "qcAHa6tt8s0l5NN7UWPVAQ=="; //requestparam Testing - TOML $input ="200904281000001|DOM|IND|INR|10|unique_10005|others|http://www.yourdomain.com/paymentSuccess.php|http://www.yourdomain.com/paymentFailure.php|TOML"; $aes = new CryptAES(); $aes-&gt;set_key(base64_decode($key)); $aes-&gt;require_pkcs5(); echo $aes-&gt;encrypt($input); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload