Sha256: 3509ea529c4b4a81c89cd5037d7aebdad7320e618028f91dc11c811fc20a8cbc
Contents?: true
Size: 713 Bytes
Versions: 8
Compression:
Stored size: 713 Bytes
Contents
var aes = require('./aes') var Transform = require('cipher-base') 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._update = function (chunk) { return this._mode.encrypt(this, chunk, this._decrypt) } StreamCipher.prototype._final = function () { this._cipher.scrub() }
Version data entries
8 entries across 8 versions & 3 rubygems