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

Version Path
lanes-0.8.0 node_modules/browserify-aes/streamCipher.js
minimum_viable_product-0.0.11 test/dummy/node_modules/browserify-aes/streamCipher.js
brwy_rails-0.0.6 test/dummy/node_modules/browserify-aes/streamCipher.js
brwy_rails-0.0.5 test/dummy/node_modules/browserify-aes/streamCipher.js
brwy_rails-0.0.4 test/dummy/node_modules/browserify-aes/streamCipher.js
brwy_rails-0.0.3 test/dummy/node_modules/browserify-aes/streamCipher.js
brwy_rails-0.0.2 test/dummy/node_modules/browserify-aes/streamCipher.js
brwy_rails-0.0.1 test/dummy/node_modules/browserify-aes/streamCipher.js