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

@stablelib/aes

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stablelib/aes - npm Package Compare versions

Comparing version 0.7.3 to 1.0.0

24

aes.ts
// Copyright (C) 2016 Dmitry Chestnykh
// MIT License. See LICENSE file for details.
/**
* Package aes implements AES block cipher.
*/
// Ported from Go implementation

@@ -81,4 +85,3 @@ //

if ((j & k) !== 0) {
// s += i in GF(2); xor in binary
s ^= i;
s ^= i; // xor in binary is s += i in GF(2)
j ^= k; // turn off bit to end loop early

@@ -134,5 +137,5 @@ }

*
* This implementation uses lookup tables, so it's susceptible to cache-timing
* side-channel attacks. A constant-time version we tried was super slow (a few
* kilobytes per second), so we'll have to live with it.
* WARNING: This implementation uses lookup tables, so it's susceptible to cache-timing
* side-channel attacks. (A constant-time version we tried was super slow: a few
* kilobytes per second)
*

@@ -162,3 +165,2 @@ * Key size: 16, 24 or 32 bytes, block size: 16 bytes.

* is not used (such as AES-CTR).
*
*/

@@ -174,3 +176,3 @@ constructor(key: Uint8Array, noDecryption = false) {

/**
* Re-initializes this instance with the new key.
* Re-initializes this instance with a new key.
*

@@ -206,3 +208,3 @@ * This is helpful to avoid allocations.

/**
* Cleans expanded keys from memory, setting them to zeros.
* Erases expanded keys from memory.
*/

@@ -219,7 +221,7 @@ clean(): this {

// TODO(dchest): specify if blocks can be the same array.
/**
* Encrypt 16-byte block src into 16-byte block dst.
*
* Source and destination may point to the same byte array.
*
* This function should not be used to encrypt data without any

@@ -246,2 +248,4 @@ * cipher mode! It should only be used to implement a cipher mode.

*
* Source and destination may point to the same byte array.
*
* This function should not be used to encrypt data without any

@@ -248,0 +252,0 @@ * cipher mode! It should only be used to implement a cipher mode.

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

/**
* Package aes implements AES block cipher.
*/
import { BlockCipher } from "@stablelib/blockcipher";

@@ -5,5 +8,5 @@ /**

*
* This implementation uses lookup tables, so it's susceptible to cache-timing
* side-channel attacks. A constant-time version we tried was super slow (a few
* kilobytes per second), so we'll have to live with it.
* WARNING: This implementation uses lookup tables, so it's susceptible to cache-timing
* side-channel attacks. (A constant-time version we tried was super slow: a few
* kilobytes per second)
*

@@ -13,3 +16,3 @@ * Key size: 16, 24 or 32 bytes, block size: 16 bytes.

export declare class AES implements BlockCipher {
readonly blockSize: number;
readonly blockSize = 16;
private _keyLen;

@@ -25,7 +28,6 @@ private _encKey;

* is not used (such as AES-CTR).
*
*/
constructor(key: Uint8Array, noDecryption?: boolean);
/**
* Re-initializes this instance with the new key.
* Re-initializes this instance with a new key.
*

@@ -36,3 +38,3 @@ * This is helpful to avoid allocations.

/**
* Cleans expanded keys from memory, setting them to zeros.
* Erases expanded keys from memory.
*/

@@ -43,2 +45,4 @@ clean(): this;

*
* Source and destination may point to the same byte array.
*
* This function should not be used to encrypt data without any

@@ -51,2 +55,4 @@ * cipher mode! It should only be used to implement a cipher mode.

*
* Source and destination may point to the same byte array.
*
* This function should not be used to encrypt data without any

@@ -53,0 +59,0 @@ * cipher mode! It should only be used to implement a cipher mode.

@@ -65,4 +65,3 @@ "use strict";

if ((j & k) !== 0) {
// s += i in GF(2); xor in binary
s ^= i;
s ^= i; // xor in binary is s += i in GF(2)
j ^= k; // turn off bit to end loop early

@@ -119,5 +118,5 @@ }

*
* This implementation uses lookup tables, so it's susceptible to cache-timing
* side-channel attacks. A constant-time version we tried was super slow (a few
* kilobytes per second), so we'll have to live with it.
* WARNING: This implementation uses lookup tables, so it's susceptible to cache-timing
* side-channel attacks. (A constant-time version we tried was super slow: a few
* kilobytes per second)
*

@@ -134,3 +133,2 @@ * Key size: 16, 24 or 32 bytes, block size: 16 bytes.

* is not used (such as AES-CTR).
*
*/

@@ -148,3 +146,3 @@ function AES(key, noDecryption) {

/**
* Re-initializes this instance with the new key.
* Re-initializes this instance with a new key.
*

@@ -180,3 +178,3 @@ * This is helpful to avoid allocations.

/**
* Cleans expanded keys from memory, setting them to zeros.
* Erases expanded keys from memory.
*/

@@ -192,6 +190,7 @@ AES.prototype.clean = function () {

};
// TODO(dchest): specify if blocks can be the same array.
/**
* Encrypt 16-byte block src into 16-byte block dst.
*
* Source and destination may point to the same byte array.
*
* This function should not be used to encrypt data without any

@@ -215,2 +214,4 @@ * cipher mode! It should only be used to implement a cipher mode.

*
* Source and destination may point to the same byte array.
*
* This function should not be used to encrypt data without any

@@ -217,0 +218,0 @@ * cipher mode! It should only be used to implement a cipher mode.

{
"name": "@stablelib/aes",
"version": "0.7.3",
"version": "1.0.0",
"description": "AES block cipher (Advanced Encryption Standard)",

@@ -18,11 +18,11 @@ "main": "./lib/aes.js",

"dependencies": {
"@stablelib/binary": "^0.7.2",
"@stablelib/blockcipher": "^0.5.0",
"@stablelib/wipe": "^0.5.0"
"@stablelib/binary": "^1.0.0",
"@stablelib/blockcipher": "^1.0.0",
"@stablelib/wipe": "^1.0.0"
},
"devDependencies": {
"@stablelib/benchmark": "^0.5.0",
"@stablelib/hex": "^0.5.0"
"@stablelib/benchmark": "^1.0.0",
"@stablelib/hex": "^1.0.0"
},
"gitHead": "dd08cfe89bc89b4106f0c9705db6281dd7357b26"
"gitHead": "c3b9e138650642a738a9225956c75dbe44c76ae6"
}

Sorry, the diff of this file is not supported yet

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