Advertisement
Guest User

Untitled

a guest
May 6th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. const crypto = require('crypto');
  2. const fs = require('fs');
  3.  
  4. const cipher = crypto.createCipher('aes192', 'a password');
  5.  
  6. const encInput = fs.createReadStream('test.txt');
  7. const encOutput = fs.createWriteStream('test.encrypted');
  8.  
  9. encInput.pipe(cipher).pipe(encOutput);
  10.  
  11. const decipher = crypto.createDecipher('aes192', 'a password');
  12.  
  13. const decInput = fs.createReadStream('test.encrypted');
  14. const decOutput = fs.createWriteStream('test.decrypted');
  15.  
  16. decInput.pipe(decipher).pipe(decOutput);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement