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

aes-decrypter

Package Overview
Dependencies
Maintainers
17
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aes-decrypter - npm Package Compare versions

Comparing version 3.1.3 to 4.0.1

19

CHANGELOG.md

@@ -0,1 +1,20 @@

<a name="4.0.1"></a>
## [4.0.1](https://github.com/videojs/aes-decrypter/compare/v4.0.0...v4.0.1) (2022-08-18)
### Chores
* do not run es-check on publish ([#87](https://github.com/videojs/aes-decrypter/issues/87)) ([6f0cbd9](https://github.com/videojs/aes-decrypter/commit/6f0cbd9))
<a name="4.0.0"></a>
# [4.0.0](https://github.com/videojs/aes-decrypter/compare/v3.1.3...v4.0.0) (2022-08-18)
### Chores
* **package:** remove IE11 support ([#86](https://github.com/videojs/aes-decrypter/issues/86)) ([3338e9b](https://github.com/videojs/aes-decrypter/commit/3338e9b))
### BREAKING CHANGES
* **package:** Internet Explorer is no longer supported.
<a name="3.1.3"></a>

@@ -2,0 +21,0 @@ ## [3.1.3](https://github.com/videojs/aes-decrypter/compare/v3.1.2...v3.1.3) (2022-04-05)

213

dist/aes-decrypter.cjs.js

@@ -1,2 +0,2 @@

/*! @name aes-decrypter @version 3.1.3 @license Apache-2.0 */
/*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */
'use strict';

@@ -6,4 +6,2 @@

var _createClass = require('@babel/runtime/helpers/createClass');
var _inheritsLoose = require('@babel/runtime/helpers/inheritsLoose');
var Stream = require('@videojs/vhs-utils/cjs/stream.js');

@@ -14,4 +12,2 @@ var pkcs7 = require('pkcs7');

var _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass);
var _inheritsLoose__default = /*#__PURE__*/_interopDefaultLegacy(_inheritsLoose);
var Stream__default = /*#__PURE__*/_interopDefaultLegacy(Stream);

@@ -63,19 +59,19 @@

*/
var precompute = function precompute() {
var tables = [[[], [], [], [], []], [[], [], [], [], []]];
var encTable = tables[0];
var decTable = tables[1];
var sbox = encTable[4];
var sboxInv = decTable[4];
var i;
var x;
var xInv;
var d = [];
var th = [];
var x2;
var x4;
var x8;
var s;
var tEnc;
var tDec; // Compute double and third tables
const precompute = function () {
const tables = [[[], [], [], [], []], [[], [], [], [], []]];
const encTable = tables[0];
const decTable = tables[1];
const sbox = encTable[4];
const sboxInv = decTable[4];
let i;
let x;
let xInv;
const d = [];
const th = [];
let x2;
let x4;
let x8;
let s;
let tEnc;
let tDec; // Compute double and third tables

@@ -112,3 +108,3 @@ for (i = 0; i < 256; i++) {

var aesTables = null;
let aesTables = null;
/**

@@ -122,4 +118,4 @@ * Schedule out an AES key for both encryption and decryption. This

var AES = /*#__PURE__*/function () {
function AES(key) {
class AES {
constructor(key) {
/**

@@ -145,9 +141,9 @@ * The expanded S-box and inverse S-box tables. These will be computed

this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]];
var i;
var j;
var tmp;
var sbox = this._tables[0][4];
var decTable = this._tables[1];
var keyLen = key.length;
var rcon = 1;
let i;
let j;
let tmp;
const sbox = this._tables[0][4];
const decTable = this._tables[1];
const keyLen = key.length;
let rcon = 1;

@@ -158,4 +154,4 @@ if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {

var encKey = key.slice(0);
var decKey = [];
const encKey = key.slice(0);
const decKey = [];
this._key = [encKey, decKey]; // schedule encryption keys

@@ -204,26 +200,24 @@

var _proto = AES.prototype;
decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) {
const key = this._key[1]; // state variables a,b,c,d are loaded with pre-whitened data
_proto.decrypt = function decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) {
var key = this._key[1]; // state variables a,b,c,d are loaded with pre-whitened data
let a = encrypted0 ^ key[0];
let b = encrypted3 ^ key[1];
let c = encrypted2 ^ key[2];
let d = encrypted1 ^ key[3];
let a2;
let b2;
let c2; // key.length === 2 ?
var a = encrypted0 ^ key[0];
var b = encrypted3 ^ key[1];
var c = encrypted2 ^ key[2];
var d = encrypted1 ^ key[3];
var a2;
var b2;
var c2; // key.length === 2 ?
const nInnerRounds = key.length / 4 - 2;
let i;
let kIndex = 4;
const table = this._tables[1]; // load up the tables
var nInnerRounds = key.length / 4 - 2;
var i;
var kIndex = 4;
var table = this._tables[1]; // load up the tables
const table0 = table[0];
const table1 = table[1];
const table2 = table[2];
const table3 = table[3];
const sbox = table[4]; // Inner rounds. Cribbed from OpenSSL.
var table0 = table[0];
var table1 = table[1];
var table2 = table[2];
var table3 = table[3];
var sbox = table[4]; // Inner rounds. Cribbed from OpenSSL.
for (i = 0; i < nInnerRounds; i++) {

@@ -249,8 +243,10 @@ a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d & 255] ^ key[kIndex];

}
};
}
return AES;
}();
}
/**
* @file async-stream.js
*/
/**
* A wrapper around the Stream class to use setTimeout

@@ -263,13 +259,8 @@ * and run stream "jobs" Asynchronously

var AsyncStream = /*#__PURE__*/function (_Stream) {
_inheritsLoose__default['default'](AsyncStream, _Stream);
function AsyncStream() {
var _this;
_this = _Stream.call(this, Stream__default['default']) || this;
_this.jobs = [];
_this.delay = 1;
_this.timeout_ = null;
return _this;
class AsyncStream extends Stream__default["default"] {
constructor() {
super(Stream__default["default"]);
this.jobs = [];
this.delay = 1;
this.timeout_ = null;
}

@@ -283,5 +274,3 @@ /**

var _proto = AsyncStream.prototype;
_proto.processJob_ = function processJob_() {
processJob_() {
this.jobs.shift()();

@@ -300,5 +289,5 @@

*/
;
_proto.push = function push(job) {
push(job) {
this.jobs.push(job);

@@ -309,8 +298,13 @@

}
};
}
return AsyncStream;
}(Stream__default['default']);
}
/**
* @file decrypter.js
*
* An asynchronous implementation of AES-128 CBC decryption with
* PKCS#7 padding.
*/
/**
* Convert network-order (big-endian) bytes into their little-endian

@@ -320,3 +314,3 @@ * representation.

var ntoh = function ntoh(word) {
const ntoh = function (word) {
return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24;

@@ -339,21 +333,21 @@ };

var decrypt = function decrypt(encrypted, key, initVector) {
const decrypt = function (encrypted, key, initVector) {
// word-level access to the encrypted bytes
var encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2);
var decipher = new AES(Array.prototype.slice.call(key)); // byte and word-level access for the decrypted output
const encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2);
const decipher = new AES(Array.prototype.slice.call(key)); // byte and word-level access for the decrypted output
var decrypted = new Uint8Array(encrypted.byteLength);
var decrypted32 = new Int32Array(decrypted.buffer); // temporary variables for working with the IV, encrypted, and
const decrypted = new Uint8Array(encrypted.byteLength);
const decrypted32 = new Int32Array(decrypted.buffer); // temporary variables for working with the IV, encrypted, and
// decrypted data
var init0;
var init1;
var init2;
var init3;
var encrypted0;
var encrypted1;
var encrypted2;
var encrypted3; // iteration variable
let init0;
let init1;
let init2;
let init3;
let encrypted0;
let encrypted1;
let encrypted2;
let encrypted3; // iteration variable
var wordIx; // pull out the words of the IV to ensure we don't modify the
let wordIx; // pull out the words of the IV to ensure we don't modify the
// passed-in reference and easier access

@@ -404,8 +398,8 @@

var Decrypter = /*#__PURE__*/function () {
function Decrypter(encrypted, key, initVector, done) {
var step = Decrypter.STEP;
var encrypted32 = new Int32Array(encrypted.buffer);
var decrypted = new Uint8Array(encrypted.byteLength);
var i = 0;
class Decrypter {
constructor(encrypted, key, initVector, done) {
const step = Decrypter.STEP;
const encrypted32 = new Int32Array(encrypted.buffer);
const decrypted = new Uint8Array(encrypted.byteLength);
let i = 0;
this.asyncStream_ = new AsyncStream(); // split up the encryption job and do the individual chunks asynchronously

@@ -433,27 +427,22 @@

var _proto = Decrypter.prototype;
static get STEP() {
// 4 * 8000;
return 32000;
}
/**
* @private
*/
_proto.decryptChunk_ = function decryptChunk_(encrypted, key, initVector, decrypted) {
decryptChunk_(encrypted, key, initVector, decrypted) {
return function () {
var bytes = decrypt(encrypted, key, initVector);
const bytes = decrypt(encrypted, key, initVector);
decrypted.set(bytes, encrypted.byteOffset);
};
};
}
_createClass__default['default'](Decrypter, null, [{
key: "STEP",
get: function get() {
// 4 * 8000;
return 32000;
}
}]);
}
return Decrypter;
}();
exports.AsyncStream = AsyncStream;
exports.Decrypter = Decrypter;
exports.decrypt = decrypt;

@@ -1,4 +0,2 @@

/*! @name aes-decrypter @version 3.1.3 @license Apache-2.0 */
import _createClass from '@babel/runtime/helpers/createClass';
import _inheritsLoose from '@babel/runtime/helpers/inheritsLoose';
/*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */
import Stream from '@videojs/vhs-utils/es/stream.js';

@@ -51,19 +49,19 @@ import { unpad } from 'pkcs7';

*/
var precompute = function precompute() {
var tables = [[[], [], [], [], []], [[], [], [], [], []]];
var encTable = tables[0];
var decTable = tables[1];
var sbox = encTable[4];
var sboxInv = decTable[4];
var i;
var x;
var xInv;
var d = [];
var th = [];
var x2;
var x4;
var x8;
var s;
var tEnc;
var tDec; // Compute double and third tables
const precompute = function () {
const tables = [[[], [], [], [], []], [[], [], [], [], []]];
const encTable = tables[0];
const decTable = tables[1];
const sbox = encTable[4];
const sboxInv = decTable[4];
let i;
let x;
let xInv;
const d = [];
const th = [];
let x2;
let x4;
let x8;
let s;
let tEnc;
let tDec; // Compute double and third tables

@@ -100,3 +98,3 @@ for (i = 0; i < 256; i++) {

var aesTables = null;
let aesTables = null;
/**

@@ -110,4 +108,4 @@ * Schedule out an AES key for both encryption and decryption. This

var AES = /*#__PURE__*/function () {
function AES(key) {
class AES {
constructor(key) {
/**

@@ -133,9 +131,9 @@ * The expanded S-box and inverse S-box tables. These will be computed

this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]];
var i;
var j;
var tmp;
var sbox = this._tables[0][4];
var decTable = this._tables[1];
var keyLen = key.length;
var rcon = 1;
let i;
let j;
let tmp;
const sbox = this._tables[0][4];
const decTable = this._tables[1];
const keyLen = key.length;
let rcon = 1;

@@ -146,4 +144,4 @@ if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {

var encKey = key.slice(0);
var decKey = [];
const encKey = key.slice(0);
const decKey = [];
this._key = [encKey, decKey]; // schedule encryption keys

@@ -192,26 +190,24 @@

var _proto = AES.prototype;
decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) {
const key = this._key[1]; // state variables a,b,c,d are loaded with pre-whitened data
_proto.decrypt = function decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) {
var key = this._key[1]; // state variables a,b,c,d are loaded with pre-whitened data
let a = encrypted0 ^ key[0];
let b = encrypted3 ^ key[1];
let c = encrypted2 ^ key[2];
let d = encrypted1 ^ key[3];
let a2;
let b2;
let c2; // key.length === 2 ?
var a = encrypted0 ^ key[0];
var b = encrypted3 ^ key[1];
var c = encrypted2 ^ key[2];
var d = encrypted1 ^ key[3];
var a2;
var b2;
var c2; // key.length === 2 ?
const nInnerRounds = key.length / 4 - 2;
let i;
let kIndex = 4;
const table = this._tables[1]; // load up the tables
var nInnerRounds = key.length / 4 - 2;
var i;
var kIndex = 4;
var table = this._tables[1]; // load up the tables
const table0 = table[0];
const table1 = table[1];
const table2 = table[2];
const table3 = table[3];
const sbox = table[4]; // Inner rounds. Cribbed from OpenSSL.
var table0 = table[0];
var table1 = table[1];
var table2 = table[2];
var table3 = table[3];
var sbox = table[4]; // Inner rounds. Cribbed from OpenSSL.
for (i = 0; i < nInnerRounds; i++) {

@@ -237,8 +233,10 @@ a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d & 255] ^ key[kIndex];

}
};
}
return AES;
}();
}
/**
* @file async-stream.js
*/
/**
* A wrapper around the Stream class to use setTimeout

@@ -251,13 +249,8 @@ * and run stream "jobs" Asynchronously

var AsyncStream = /*#__PURE__*/function (_Stream) {
_inheritsLoose(AsyncStream, _Stream);
function AsyncStream() {
var _this;
_this = _Stream.call(this, Stream) || this;
_this.jobs = [];
_this.delay = 1;
_this.timeout_ = null;
return _this;
class AsyncStream extends Stream {
constructor() {
super(Stream);
this.jobs = [];
this.delay = 1;
this.timeout_ = null;
}

@@ -271,5 +264,3 @@ /**

var _proto = AsyncStream.prototype;
_proto.processJob_ = function processJob_() {
processJob_() {
this.jobs.shift()();

@@ -288,5 +279,5 @@

*/
;
_proto.push = function push(job) {
push(job) {
this.jobs.push(job);

@@ -297,8 +288,13 @@

}
};
}
return AsyncStream;
}(Stream);
}
/**
* @file decrypter.js
*
* An asynchronous implementation of AES-128 CBC decryption with
* PKCS#7 padding.
*/
/**
* Convert network-order (big-endian) bytes into their little-endian

@@ -308,3 +304,3 @@ * representation.

var ntoh = function ntoh(word) {
const ntoh = function (word) {
return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24;

@@ -327,21 +323,21 @@ };

var decrypt = function decrypt(encrypted, key, initVector) {
const decrypt = function (encrypted, key, initVector) {
// word-level access to the encrypted bytes
var encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2);
var decipher = new AES(Array.prototype.slice.call(key)); // byte and word-level access for the decrypted output
const encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2);
const decipher = new AES(Array.prototype.slice.call(key)); // byte and word-level access for the decrypted output
var decrypted = new Uint8Array(encrypted.byteLength);
var decrypted32 = new Int32Array(decrypted.buffer); // temporary variables for working with the IV, encrypted, and
const decrypted = new Uint8Array(encrypted.byteLength);
const decrypted32 = new Int32Array(decrypted.buffer); // temporary variables for working with the IV, encrypted, and
// decrypted data
var init0;
var init1;
var init2;
var init3;
var encrypted0;
var encrypted1;
var encrypted2;
var encrypted3; // iteration variable
let init0;
let init1;
let init2;
let init3;
let encrypted0;
let encrypted1;
let encrypted2;
let encrypted3; // iteration variable
var wordIx; // pull out the words of the IV to ensure we don't modify the
let wordIx; // pull out the words of the IV to ensure we don't modify the
// passed-in reference and easier access

@@ -392,8 +388,8 @@

var Decrypter = /*#__PURE__*/function () {
function Decrypter(encrypted, key, initVector, done) {
var step = Decrypter.STEP;
var encrypted32 = new Int32Array(encrypted.buffer);
var decrypted = new Uint8Array(encrypted.byteLength);
var i = 0;
class Decrypter {
constructor(encrypted, key, initVector, done) {
const step = Decrypter.STEP;
const encrypted32 = new Int32Array(encrypted.buffer);
const decrypted = new Uint8Array(encrypted.byteLength);
let i = 0;
this.asyncStream_ = new AsyncStream(); // split up the encryption job and do the individual chunks asynchronously

@@ -421,25 +417,20 @@

var _proto = Decrypter.prototype;
static get STEP() {
// 4 * 8000;
return 32000;
}
/**
* @private
*/
_proto.decryptChunk_ = function decryptChunk_(encrypted, key, initVector, decrypted) {
decryptChunk_(encrypted, key, initVector, decrypted) {
return function () {
var bytes = decrypt(encrypted, key, initVector);
const bytes = decrypt(encrypted, key, initVector);
decrypted.set(bytes, encrypted.byteOffset);
};
};
}
_createClass(Decrypter, null, [{
key: "STEP",
get: function get() {
// 4 * 8000;
return 32000;
}
}]);
}
return Decrypter;
}();
export { AsyncStream, Decrypter, decrypt };

@@ -1,2 +0,2 @@

/*! @name aes-decrypter @version 3.1.3 @license Apache-2.0 */
/*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */
(function (global, factory) {

@@ -6,22 +6,4 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.aesDecrypter = {}));
}(this, (function (exports) { 'use strict';
})(this, (function (exports) { 'use strict';
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var createClass = _createClass;
/**

@@ -71,19 +53,19 @@ * @file aes.js

*/
var precompute = function precompute() {
var tables = [[[], [], [], [], []], [[], [], [], [], []]];
var encTable = tables[0];
var decTable = tables[1];
var sbox = encTable[4];
var sboxInv = decTable[4];
var i;
var x;
var xInv;
var d = [];
var th = [];
var x2;
var x4;
var x8;
var s;
var tEnc;
var tDec; // Compute double and third tables
const precompute = function () {
const tables = [[[], [], [], [], []], [[], [], [], [], []]];
const encTable = tables[0];
const decTable = tables[1];
const sbox = encTable[4];
const sboxInv = decTable[4];
let i;
let x;
let xInv;
const d = [];
const th = [];
let x2;
let x4;
let x8;
let s;
let tEnc;
let tDec; // Compute double and third tables

@@ -120,3 +102,3 @@ for (i = 0; i < 256; i++) {

var aesTables = null;
let aesTables = null;
/**

@@ -130,4 +112,4 @@ * Schedule out an AES key for both encryption and decryption. This

var AES = /*#__PURE__*/function () {
function AES(key) {
class AES {
constructor(key) {
/**

@@ -153,9 +135,9 @@ * The expanded S-box and inverse S-box tables. These will be computed

this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]];
var i;
var j;
var tmp;
var sbox = this._tables[0][4];
var decTable = this._tables[1];
var keyLen = key.length;
var rcon = 1;
let i;
let j;
let tmp;
const sbox = this._tables[0][4];
const decTable = this._tables[1];
const keyLen = key.length;
let rcon = 1;

@@ -166,4 +148,4 @@ if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {

var encKey = key.slice(0);
var decKey = [];
const encKey = key.slice(0);
const decKey = [];
this._key = [encKey, decKey]; // schedule encryption keys

@@ -212,26 +194,24 @@

var _proto = AES.prototype;
decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) {
const key = this._key[1]; // state variables a,b,c,d are loaded with pre-whitened data
_proto.decrypt = function decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) {
var key = this._key[1]; // state variables a,b,c,d are loaded with pre-whitened data
let a = encrypted0 ^ key[0];
let b = encrypted3 ^ key[1];
let c = encrypted2 ^ key[2];
let d = encrypted1 ^ key[3];
let a2;
let b2;
let c2; // key.length === 2 ?
var a = encrypted0 ^ key[0];
var b = encrypted3 ^ key[1];
var c = encrypted2 ^ key[2];
var d = encrypted1 ^ key[3];
var a2;
var b2;
var c2; // key.length === 2 ?
const nInnerRounds = key.length / 4 - 2;
let i;
let kIndex = 4;
const table = this._tables[1]; // load up the tables
var nInnerRounds = key.length / 4 - 2;
var i;
var kIndex = 4;
var table = this._tables[1]; // load up the tables
const table0 = table[0];
const table1 = table[1];
const table2 = table[2];
const table3 = table[3];
const sbox = table[4]; // Inner rounds. Cribbed from OpenSSL.
var table0 = table[0];
var table1 = table[1];
var table2 = table[2];
var table3 = table[3];
var sbox = table[4]; // Inner rounds. Cribbed from OpenSSL.
for (i = 0; i < nInnerRounds; i++) {

@@ -257,15 +237,6 @@ a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d & 255] ^ key[kIndex];

}
};
}
return AES;
}();
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
var inheritsLoose = _inheritsLoose;
/**

@@ -392,2 +363,5 @@ * @file stream.js

/**
* @file async-stream.js
*/
/**
* A wrapper around the Stream class to use setTimeout

@@ -400,13 +374,8 @@ * and run stream "jobs" Asynchronously

var AsyncStream = /*#__PURE__*/function (_Stream) {
inheritsLoose(AsyncStream, _Stream);
function AsyncStream() {
var _this;
_this = _Stream.call(this, Stream) || this;
_this.jobs = [];
_this.delay = 1;
_this.timeout_ = null;
return _this;
class AsyncStream extends Stream {
constructor() {
super(Stream);
this.jobs = [];
this.delay = 1;
this.timeout_ = null;
}

@@ -420,5 +389,3 @@ /**

var _proto = AsyncStream.prototype;
_proto.processJob_ = function processJob_() {
processJob_() {
this.jobs.shift()();

@@ -437,5 +404,5 @@

*/
;
_proto.push = function push(job) {
push(job) {
this.jobs.push(job);

@@ -446,6 +413,5 @@

}
};
}
return AsyncStream;
}(Stream);
}

@@ -466,2 +432,8 @@ /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */

/**
* @file decrypter.js
*
* An asynchronous implementation of AES-128 CBC decryption with
* PKCS#7 padding.
*/
/**
* Convert network-order (big-endian) bytes into their little-endian

@@ -471,3 +443,3 @@ * representation.

var ntoh = function ntoh(word) {
const ntoh = function (word) {
return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24;

@@ -490,21 +462,21 @@ };

var decrypt = function decrypt(encrypted, key, initVector) {
const decrypt = function (encrypted, key, initVector) {
// word-level access to the encrypted bytes
var encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2);
var decipher = new AES(Array.prototype.slice.call(key)); // byte and word-level access for the decrypted output
const encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2);
const decipher = new AES(Array.prototype.slice.call(key)); // byte and word-level access for the decrypted output
var decrypted = new Uint8Array(encrypted.byteLength);
var decrypted32 = new Int32Array(decrypted.buffer); // temporary variables for working with the IV, encrypted, and
const decrypted = new Uint8Array(encrypted.byteLength);
const decrypted32 = new Int32Array(decrypted.buffer); // temporary variables for working with the IV, encrypted, and
// decrypted data
var init0;
var init1;
var init2;
var init3;
var encrypted0;
var encrypted1;
var encrypted2;
var encrypted3; // iteration variable
let init0;
let init1;
let init2;
let init3;
let encrypted0;
let encrypted1;
let encrypted2;
let encrypted3; // iteration variable
var wordIx; // pull out the words of the IV to ensure we don't modify the
let wordIx; // pull out the words of the IV to ensure we don't modify the
// passed-in reference and easier access

@@ -555,8 +527,8 @@

var Decrypter = /*#__PURE__*/function () {
function Decrypter(encrypted, key, initVector, done) {
var step = Decrypter.STEP;
var encrypted32 = new Int32Array(encrypted.buffer);
var decrypted = new Uint8Array(encrypted.byteLength);
var i = 0;
class Decrypter {
constructor(encrypted, key, initVector, done) {
const step = Decrypter.STEP;
const encrypted32 = new Int32Array(encrypted.buffer);
const decrypted = new Uint8Array(encrypted.byteLength);
let i = 0;
this.asyncStream_ = new AsyncStream(); // split up the encryption job and do the individual chunks asynchronously

@@ -584,25 +556,20 @@

var _proto = Decrypter.prototype;
static get STEP() {
// 4 * 8000;
return 32000;
}
/**
* @private
*/
_proto.decryptChunk_ = function decryptChunk_(encrypted, key, initVector, decrypted) {
decryptChunk_(encrypted, key, initVector, decrypted) {
return function () {
var bytes = decrypt(encrypted, key, initVector);
const bytes = decrypt(encrypted, key, initVector);
decrypted.set(bytes, encrypted.byteOffset);
};
};
}
createClass(Decrypter, null, [{
key: "STEP",
get: function get() {
// 4 * 8000;
return 32000;
}
}]);
}
return Decrypter;
}();
exports.AsyncStream = AsyncStream;

@@ -614,2 +581,2 @@ exports.Decrypter = Decrypter;

})));
}));

@@ -1,4 +0,3 @@

/*! @name aes-decrypter @version 3.1.3 @license Apache-2.0 */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).aesDecrypter={})}(this,(function(t){"use strict";function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var n=function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t},r=null,i=function(){function t(t){var e,n,i;r||(r=function(){var t,e,n,r,i,s,o,u,l=[[[],[],[],[],[]],[[],[],[],[],[]]],c=l[0],f=l[1],a=c[4],h=f[4],y=[],p=[];for(t=0;t<256;t++)p[(y[t]=t<<1^283*(t>>7))^t]=t;for(e=n=0;!a[e];e^=r||1,n=p[n]||1)for(s=(s=n^n<<1^n<<2^n<<3^n<<4)>>8^255&s^99,a[e]=s,h[s]=e,u=16843009*y[i=y[r=y[e]]]^65537*i^257*r^16843008*e,o=257*y[s]^16843008*s,t=0;t<4;t++)c[t][e]=o=o<<24^o>>>8,f[t][s]=u=u<<24^u>>>8;for(t=0;t<5;t++)c[t]=c[t].slice(0),f[t]=f[t].slice(0);return l}()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];var s=this._tables[0][4],o=this._tables[1],u=t.length,l=1;if(4!==u&&6!==u&&8!==u)throw new Error("Invalid aes key size");var c=t.slice(0),f=[];for(this._key=[c,f],e=u;e<4*u+28;e++)i=c[e-1],(e%u==0||8===u&&e%u==4)&&(i=s[i>>>24]<<24^s[i>>16&255]<<16^s[i>>8&255]<<8^s[255&i],e%u==0&&(i=i<<8^i>>>24^l<<24,l=l<<1^283*(l>>7))),c[e]=c[e-u]^i;for(n=0;e;n++,e--)i=c[3&n?e:e-4],f[n]=e<=4||n<4?i:o[0][s[i>>>24]]^o[1][s[i>>16&255]]^o[2][s[i>>8&255]]^o[3][s[255&i]]}return t.prototype.decrypt=function(t,e,n,r,i,s){var o,u,l,c,f=this._key[1],a=t^f[0],h=r^f[1],y=n^f[2],p=e^f[3],b=f.length/4-2,d=4,_=this._tables[1],v=_[0],g=_[1],m=_[2],w=_[3],A=_[4];for(c=0;c<b;c++)o=v[a>>>24]^g[h>>16&255]^m[y>>8&255]^w[255&p]^f[d],u=v[h>>>24]^g[y>>16&255]^m[p>>8&255]^w[255&a]^f[d+1],l=v[y>>>24]^g[p>>16&255]^m[a>>8&255]^w[255&h]^f[d+2],p=v[p>>>24]^g[a>>16&255]^m[h>>8&255]^w[255&y]^f[d+3],d+=4,a=o,h=u,y=l;for(c=0;c<4;c++)i[(3&-c)+s]=A[a>>>24]<<24^A[h>>16&255]<<16^A[y>>8&255]<<8^A[255&p]^f[d++],o=a,a=h,h=y,y=p,p=o},t}();var s=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e},o=function(){function t(){this.listeners={}}var e=t.prototype;return e.on=function(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)},e.off=function(t,e){if(!this.listeners[t])return!1;var n=this.listeners[t].indexOf(e);return this.listeners[t]=this.listeners[t].slice(0),this.listeners[t].splice(n,1),n>-1},e.trigger=function(t){var e=this.listeners[t];if(e)if(2===arguments.length)for(var n=e.length,r=0;r<n;++r)e[r].call(this,arguments[1]);else for(var i=Array.prototype.slice.call(arguments,1),s=e.length,o=0;o<s;++o)e[o].apply(this,i)},e.dispose=function(){this.listeners={}},e.pipe=function(t){this.on("data",(function(e){t.push(e)}))},t}(),u=function(t){function e(){var e;return(e=t.call(this,o)||this).jobs=[],e.delay=1,e.timeout_=null,e}s(e,t);var n=e.prototype;return n.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},n.push=function(t){this.jobs.push(t),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},e}(o);var l=function(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24},c=function(t,e,n){var r,s,o,u,c,f,a,h,y,p=new Int32Array(t.buffer,t.byteOffset,t.byteLength>>2),b=new i(Array.prototype.slice.call(e)),d=new Uint8Array(t.byteLength),_=new Int32Array(d.buffer);for(r=n[0],s=n[1],o=n[2],u=n[3],y=0;y<p.length;y+=4)c=l(p[y]),f=l(p[y+1]),a=l(p[y+2]),h=l(p[y+3]),b.decrypt(c,f,a,h,_,y),_[y]=l(_[y]^r),_[y+1]=l(_[y+1]^s),_[y+2]=l(_[y+2]^o),_[y+3]=l(_[y+3]^u),r=c,s=f,o=a,u=h;return d},f=function(){function t(e,n,r,i){var s=t.STEP,o=new Int32Array(e.buffer),c=new Uint8Array(e.byteLength),f=0;for(this.asyncStream_=new u,this.asyncStream_.push(this.decryptChunk_(o.subarray(f,f+s),n,r,c)),f=s;f<o.length;f+=s)r=new Uint32Array([l(o[f-4]),l(o[f-3]),l(o[f-2]),l(o[f-1])]),this.asyncStream_.push(this.decryptChunk_(o.subarray(f,f+s),n,r,c));this.asyncStream_.push((function(){
/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
var t;i(null,(t=c).subarray(0,t.byteLength-t[t.byteLength-1]))}))}return t.prototype.decryptChunk_=function(t,e,n,r){return function(){var i=c(t,e,n);r.set(i,t.byteOffset)}},n(t,null,[{key:"STEP",get:function(){return 32e3}}]),t}();t.AsyncStream=u,t.Decrypter=f,t.decrypt=c,Object.defineProperty(t,"__esModule",{value:!0})}));
/*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).aesDecrypter={})}(this,(function(t){"use strict";let e=null;class s{constructor(t){let s,i,n;e||(e=function(){const t=[[[],[],[],[],[]],[[],[],[],[],[]]],e=t[0],s=t[1],i=e[4],n=s[4];let r,o,l;const c=[],h=[];let u,f,a,y,p,b;for(r=0;r<256;r++)h[(c[r]=r<<1^283*(r>>7))^r]=r;for(o=l=0;!i[o];o^=u||1,l=h[l]||1)for(y=l^l<<1^l<<2^l<<3^l<<4,y=y>>8^255&y^99,i[o]=y,n[y]=o,a=c[f=c[u=c[o]]],b=16843009*a^65537*f^257*u^16843008*o,p=257*c[y]^16843008*y,r=0;r<4;r++)e[r][o]=p=p<<24^p>>>8,s[r][y]=b=b<<24^b>>>8;for(r=0;r<5;r++)e[r]=e[r].slice(0),s[r]=s[r].slice(0);return t}()),this._tables=[[e[0][0].slice(),e[0][1].slice(),e[0][2].slice(),e[0][3].slice(),e[0][4].slice()],[e[1][0].slice(),e[1][1].slice(),e[1][2].slice(),e[1][3].slice(),e[1][4].slice()]];const r=this._tables[0][4],o=this._tables[1],l=t.length;let c=1;if(4!==l&&6!==l&&8!==l)throw new Error("Invalid aes key size");const h=t.slice(0),u=[];for(this._key=[h,u],s=l;s<4*l+28;s++)n=h[s-1],(s%l==0||8===l&&s%l==4)&&(n=r[n>>>24]<<24^r[n>>16&255]<<16^r[n>>8&255]<<8^r[255&n],s%l==0&&(n=n<<8^n>>>24^c<<24,c=c<<1^283*(c>>7))),h[s]=h[s-l]^n;for(i=0;s;i++,s--)n=h[3&i?s:s-4],u[i]=s<=4||i<4?n:o[0][r[n>>>24]]^o[1][r[n>>16&255]]^o[2][r[n>>8&255]]^o[3][r[255&n]]}decrypt(t,e,s,i,n,r){const o=this._key[1];let l,c,h,u=t^o[0],f=i^o[1],a=s^o[2],y=e^o[3];const p=o.length/4-2;let b,d=4;const _=this._tables[1],g=_[0],m=_[1],w=_[2],v=_[3],A=_[4];for(b=0;b<p;b++)l=g[u>>>24]^m[f>>16&255]^w[a>>8&255]^v[255&y]^o[d],c=g[f>>>24]^m[a>>16&255]^w[y>>8&255]^v[255&u]^o[d+1],h=g[a>>>24]^m[y>>16&255]^w[u>>8&255]^v[255&f]^o[d+2],y=g[y>>>24]^m[u>>16&255]^w[f>>8&255]^v[255&a]^o[d+3],d+=4,u=l,f=c,a=h;for(b=0;b<4;b++)n[(3&-b)+r]=A[u>>>24]<<24^A[f>>16&255]<<16^A[a>>8&255]<<8^A[255&y]^o[d++],l=u,u=f,f=a,a=y,y=l}}var i=function(){function t(){this.listeners={}}var e=t.prototype;return e.on=function(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)},e.off=function(t,e){if(!this.listeners[t])return!1;var s=this.listeners[t].indexOf(e);return this.listeners[t]=this.listeners[t].slice(0),this.listeners[t].splice(s,1),s>-1},e.trigger=function(t){var e=this.listeners[t];if(e)if(2===arguments.length)for(var s=e.length,i=0;i<s;++i)e[i].call(this,arguments[1]);else for(var n=Array.prototype.slice.call(arguments,1),r=e.length,o=0;o<r;++o)e[o].apply(this,n)},e.dispose=function(){this.listeners={}},e.pipe=function(t){this.on("data",(function(e){t.push(e)}))},t}();class n extends i{constructor(){super(i),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(t){this.jobs.push(t),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}
/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */const r=function(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24},o=function(t,e,i){const n=new Int32Array(t.buffer,t.byteOffset,t.byteLength>>2),o=new s(Array.prototype.slice.call(e)),l=new Uint8Array(t.byteLength),c=new Int32Array(l.buffer);let h,u,f,a,y,p,b,d,_;for(h=i[0],u=i[1],f=i[2],a=i[3],_=0;_<n.length;_+=4)y=r(n[_]),p=r(n[_+1]),b=r(n[_+2]),d=r(n[_+3]),o.decrypt(y,p,b,d,c,_),c[_]=r(c[_]^h),c[_+1]=r(c[_+1]^u),c[_+2]=r(c[_+2]^f),c[_+3]=r(c[_+3]^a),h=y,u=p,f=b,a=d;return l};class l{constructor(t,e,s,i){const o=l.STEP,c=new Int32Array(t.buffer),h=new Uint8Array(t.byteLength);let u=0;for(this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(c.subarray(u,u+o),e,s,h)),u=o;u<c.length;u+=o)s=new Uint32Array([r(c[u-4]),r(c[u-3]),r(c[u-2]),r(c[u-1])]),this.asyncStream_.push(this.decryptChunk_(c.subarray(u,u+o),e,s,h));this.asyncStream_.push((function(){var t;i(null,(t=h).subarray(0,t.byteLength-t[t.byteLength-1]))}))}static get STEP(){return 32e3}decryptChunk_(t,e,s,i){return function(){const n=o(t,e,s);i.set(n,t.byteOffset)}}}t.AsyncStream=n,t.Decrypter=l,t.decrypt=o,Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "aes-decrypter",
"version": "3.1.3",
"version": "4.0.1",
"description": "decrypt aes-128 content using a key",

@@ -20,3 +20,3 @@ "main": "dist/aes-decrypter.cjs.js",

"lint": "vjsstandard",
"prepublishOnly": "npm-run-all build-prod && vjsverify --verbose",
"prepublishOnly": "npm-run-all build-prod && vjsverify --verbose --skip-es-check",
"start": "npm-run-all -p server watch",

@@ -60,6 +60,6 @@ "server": "karma start scripts/karma.conf.js --singleRun=false --auto-watch",

"karma": "^5.2.3",
"rollup": "^2.36.1",
"rollup": "^2.38.0",
"sinon": "^9.2.3",
"videojs-generate-karma-config": "~7.0.0",
"videojs-generate-rollup-config": "~6.1.0",
"videojs-generate-karma-config": "^8.0.1",
"videojs-generate-rollup-config": "~7.0.0",
"videojs-generator-verify": "~3.0.1",

@@ -82,6 +82,2 @@ "videojs-standard": "^8.0.4"

"homepage": "https://github.com/videojs/aes-decrypter#readme",
"browserslist": [
"defaults",
"ie 11"
],
"keywords": [

@@ -88,0 +84,0 @@ "videojs",

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