SHARE
TWEET

Untitled

a guest Sep 10th, 2012 98 Never
  1. echo "hello there" | openssl aes-256-cbc -e -base64 -nosalt -p -k password
  2.  
  3. =>
  4.  
  5. key=5F4DCC3B5AA765D61D8327DEB882CF992B95990A9151374ABD8FF8C5A7A0FE08
  6. iv =B7B4372CDFBCB3D16A2631B59B509E94
  7. +Nz/4B8NVu2NG6QZ3OHv3apKc8HOefA7VEnI+45Vnq8=
  8.  
  9. --
  10.  
  11. var crypto = require('crypto');
  12. var iv = new Buffer('B7B4372CDFBCB3D16A2631B59B509E94', 'hex');
  13. var key = new Buffer('5F4DCC3B5AA765D61D8327DEB882CF992B95990A9151374ABD8FF8C5A7A0FE08', 'hex');
  14. var decipher = crypto.createDecipheriv('aes-256-cbc', key, iv);
  15. var result = decipher.update('+Nz/4B8NVu2NG6QZ3OHv3apKc8HOefA7VEnI+45Vnq8=', 'base64', 'utf8');
  16. result += decipher.final('utf8');
  17. console.log(result);
  18.  
  19. =>
  20.  
  21. TypeError: DecipherFinal fail
  22.     at Object.<anonymous> (C:\Users\o_nix\Desktop\crypto.js:8:20)
  23.     at Module._compile (module.js:449:26)
  24.     at Object.Module._extensions..js (module.js:467:10)
  25.     at Module.load (module.js:356:32)
  26.     at Function.Module._load (module.js:312:12)
  27.     at Module.runMain (module.js:492:10)
  28.     at process.startup.processNextTick.process._tickCallback (node.js:244:9)
RAW Paste Data
Top