transporterReceive(next) { return (cmd, data, s) => { const decrypter = iv ? crypto.createDecipheriv(algorithm, password, iv) : crypto.createDecipher(algorithm, password); const res = Buffer.concat([decrypter.update(data), decrypter.final()]); return next(cmd, res, s); }; }
function decrypt (ciphertext) { var decipher = crypto.createDecipher(algorithm, 'pw') var plaintext = decipher.update(ciphertext, 'hex', 'utf8') plaintext += decipher.final('utf8') return plaintext }
function Transfer (fileInput, opts) { if (!fileInput) throw Error('File input required') var algorithm = 'aes-256-cbc' this.fileInput = fileInput this.opts = opts || {} this.httpOptions = {} this.inputStream = isReadable(fileInput) ? fileInput : fs.createReadStream(fileInput) this.encryptedStream = null this.sEncrypt = this.opts.password ? crypto.createCipher(algorithm, this.opts.password) : new PassThroughStream() this.sDecrypt = this.opts.password ? crypto.createDecipher(algorithm, this.opts.password) : new PassThroughStream() }
function decrypt(data) { // create decipher with set algo, secret and generated iv const decipher = crypto.createDecipher( process.env.CRYPTO_ALGO, process.env.CRYPTO_SECRET ); // deencrypt the passed in data const decrypted = decipher.update( data, process.env.CRYPTO_DIGEST, process.env.CRYPTO_OUT ); // return the decrypted message return `${decrypted}${deciper.final(process.env.CRYPTO_OUT)}`; }
function decrypt (content, key) { if (typeof content !== 'string') content = content.toString() let decrypted = '' let dip = crypto.createDecipher('rc4', key) decrypted += dip.update(content, 'hex', 'binary') decrypted += dip.final('binary') return decrypted }
const decrypt = (data, algorithm, passphrase) => { data = (Buffer.from(data, 'base64')).toString(); const decipher = crypto.createDecipher(algorithm, passphrase); const decrypted = decipher.update(data, 'hex', 'utf8') + decipher.final('utf8'); return decrypted; }
decrypt(secret, cipherbuffer) { if (cipherbuffer === undefined) { return undefined; } const decipher = crypto.createDecipher('aes-256-cbc', secret); const decryptedJSON = Buffer.concat([ decipher.update(cipherbuffer), // Buffer contains encrypted utf8 decipher.final() ]); return JSON.parse(decryptedJSON); // This can throw a exception }
// 对称解密算法,要求 value 是 String 或 Buffer,否则会报错 const decrypt = (key, value) => { try { let decipher = crypto.createDecipher(config.auth.cipher, key) let result = decipher.update(value, 'hex', 'utf8') result += decipher.final('utf8') return result } catch (e) { return '' } }
var decrypt = function(text) { var decipher = crypto.createDecipher('aes-256-cbc','beamline') var dec = decipher.update(text,'hex','utf8') dec += decipher.final('utf8'); return dec; }
/** * ## method to decrypt data(password) * */ function decrypt(password) { var decipher = crypto.createDecipher(algorithm, privateKey); var dec = decipher.update(password, 'hex', 'utf8'); dec += decipher.final('utf8'); return dec; }
// method to decrypt data(password) function decrypt (password) { const decipher = crypto.createDecipher(algorithm, privateKey) let dec = decipher.update(password, 'hex', 'utf8') dec += decipher.final('utf8') return dec }
function aesDecrypt(encrypted, key) { const decipher = crypto.createDecipher('aes192', key); var decrypted = decipher.update(encrypted, 'hex', 'utf8'); decrypted += decipher.final('utf8'); return decrypted; }
function decrypt (content, key) { if (typeof content !== 'string') content = content.toString() let decrypted = '' let dip = crypto.createDecipher('rc4', key) decrypted += dip.update(content, 'hex') decrypted += dip.final() return decrypted }
var aesDecrypt = function (encrypted, key) { const decipher = crypto.createDecipher('aes192', key); try { decrypted = decipher.update(encrypted, 'hex', 'utf8'); decrypted += decipher.final('utf8'); } finally { decrypted = encrypted; return decrypted; } }
// Decrypt using aes-256-cbc function decrypt(text, password){ var decipher = cryptom.createDecipher('aes-256-cbc',password); var dec = decipher.update(text,'hex','utf8'); dec += decipher.final('utf8'); return dec; }