Sha256: 006764d8bd81175ecc49bcecfb8330918fe153422c38c5514c3803775c1154c2
Contents?: true
Size: 761 Bytes
Versions: 62
Compression:
Stored size: 761 Bytes
Contents
var aes = require('./aes'); var Transform = require('./cipherBase'); var inherits = require('inherits'); inherits(StreamCipher, Transform); module.exports = StreamCipher; function StreamCipher(mode, key, iv, decrypt) { if (!(this instanceof StreamCipher)) { return new StreamCipher(mode, key, iv); } Transform.call(this); this._cipher = new aes.AES(key); this._prev = new Buffer(iv.length); this._cache = new Buffer(''); this._secCache = new Buffer(''); this._decrypt = decrypt; iv.copy(this._prev); this._mode = mode; } StreamCipher.prototype._transform = function (chunk, _, next) { next(null, this._mode.encrypt(this, chunk, this._decrypt)); }; StreamCipher.prototype._flush = function (next) { this._cipher.scrub(); next(); };
Version data entries
62 entries across 62 versions & 1 rubygems