Created
December 8, 2017 20:47
-
-
Save tuliofaria/cf5aacf85509a2e1f71b39e170f97ee1 to your computer and use it in GitHub Desktop.
Crypt e Decrypt Files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
const crypto = require('crypto') | |
const alg = 'aes-256-ctr' | |
const passwd = 'abcdabcd' | |
const read = fs.createReadStream('input.txt') | |
const write = fs.createWriteStream('output.txt') | |
const cipher = crypto.createCipher(alg, passwd) | |
read.pipe(cipher).pipe(write) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
const crypto = require('crypto') | |
const alg = 'aes-256-ctr' | |
const passwd = 'abcdabcd' | |
const read = fs.createReadStream('output.txt') | |
const write = fs.createWriteStream('decrypted.txt') | |
const cipher = crypto.createDecipher(alg, passwd) | |
read.pipe(cipher).pipe(write) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment