Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

browserify-aes

Package Overview
Dependencies
Maintainers
5
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserify-aes - npm Package Compare versions

Comparing version 1.0.8 to 1.1.0

incr32.js

33

authCipher.js

@@ -7,2 +7,3 @@ var aes = require('./aes')

var xor = require('buffer-xor')
var incr32 = require('./incr32')

@@ -21,9 +22,35 @@ function xorTest (a, b) {

function calcIv (self, iv, ck) {
if (iv.length === 12) {
self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])])
return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])])
}
var ghash = new GHASH(ck)
var len = iv.length
var toPad = len % 16
ghash.update(iv)
if (toPad) {
toPad = 16 - toPad
ghash.update(Buffer.alloc(toPad, 0))
}
ghash.update(Buffer.alloc(8, 0))
var ivBits = len * 8
var tail = Buffer.alloc(8)
tail.writeUIntBE(ivBits, 0, 8)
ghash.update(tail)
self._finID = ghash.state
var out = Buffer.from(self._finID)
incr32(out)
return out
}
function StreamCipher (mode, key, iv, decrypt) {
Transform.call(this)
this._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])])
iv = Buffer.concat([iv, Buffer.from([0, 0, 0, 2])])
var h = Buffer.alloc(4, 0)
this._cipher = new aes.AES(key)
var ck = this._cipher.encryptBlock(h)
this._ghash = new GHASH(ck)
iv = calcIv(this, iv, ck)
this._prev = Buffer.from(iv)

@@ -37,4 +64,2 @@ this._cache = Buffer.allocUnsafe(0)

var h = Buffer.alloc(4, 0)
this._ghash = new GHASH(this._cipher.encryptBlock(h))
this._authTag = null

@@ -41,0 +66,0 @@ this._called = false

2

decrypter.js

@@ -98,3 +98,3 @@ var AuthCipher = require('./authCipher')

if (typeof iv === 'string') iv = Buffer.from(iv)
if (iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)
if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)

@@ -101,0 +101,0 @@ if (typeof password === 'string') password = Buffer.from(password)

@@ -94,3 +94,3 @@ var MODES = require('./modes')

if (typeof iv === 'string') iv = Buffer.from(iv)
if (iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)
if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)

@@ -97,0 +97,0 @@ if (config.type === 'stream') {

var xor = require('buffer-xor')
function incr32 (iv) {
var len = iv.length
var item
while (len--) {
item = iv.readUInt8(len)
if (item === 255) {
iv.writeUInt8(0, len)
} else {
item++
iv.writeUInt8(item, len)
break
}
}
}
var incr32 = require('../incr32')

@@ -18,0 +5,0 @@ function getBlock (self) {

{
"name": "browserify-aes",
"version": "1.0.8",
"version": "1.1.0",
"description": "aes, for browserify",

@@ -5,0 +5,0 @@ "browser": "browser.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc