Sha256: aebf7a6eded53f9e50f83da6b699d5e2bcd01a830e0bd2cd0055c6490d48c29a

Contents?: true

Size: 850 Bytes

Versions: 8

Compression:

Stored size: 850 Bytes

Contents

function encryptByte (self, byteParam, decrypt) {
  var pad
  var i = -1
  var len = 8
  var out = 0
  var bit, value
  while (++i < len) {
    pad = self._cipher.encryptBlock(self._prev)
    bit = (byteParam & (1 << (7 - i))) ? 0x80 : 0
    value = pad[0] ^ bit
    out += ((value & 0x80) >> (i % 8))
    self._prev = shiftIn(self._prev, decrypt ? bit : value)
  }
  return out
}
exports.encrypt = function (self, chunk, decrypt) {
  var len = chunk.length
  var out = new Buffer(len)
  var i = -1
  while (++i < len) {
    out[i] = encryptByte(self, chunk[i], decrypt)
  }
  return out
}
function shiftIn (buffer, value) {
  var len = buffer.length
  var i = -1
  var out = new Buffer(buffer.length)
  buffer = Buffer.concat([buffer, new Buffer([value])])
  while (++i < len) {
    out[i] = buffer[i] << 1 | buffer[i + 1] >> (7)
  }
  return out
}

Version data entries

8 entries across 8 versions & 3 rubygems

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