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

@stablelib/ctr

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/ctr - npm Package Compare versions

Comparing version 0.7.2 to 0.8.0

12

ctr.ts

@@ -17,3 +17,3 @@ // Copyright (C) 2016 Dmitry Chestnykh

private _bufpos = 0;
private _cipher: BlockCipher;
private _cipher: BlockCipher | undefined;

@@ -33,2 +33,6 @@ constructor(cipher: BlockCipher, iv: Uint8Array) {

setCipher(cipher: BlockCipher, iv: Uint8Array): this {
// Reset this._cipher to prevent reusing the existing one,
// if this method throws.
this._cipher = undefined;
if (iv.length !== this._counter.length) {

@@ -54,3 +58,5 @@ throw new Error("CTR: iv length must be equal to cipher block size");

this._bufpos = this._buffer.length;
// Cleaning cipher is caller's responsibility.
// Cleaning cipher is caller's responsibility,
// just remove a reference to it.
this._cipher = undefined;
return this;

@@ -60,3 +66,3 @@ }

private fillBuffer() {
this._cipher.encryptBlock(this._counter, this._buffer);
this._cipher!.encryptBlock(this._counter, this._buffer);
this._bufpos = 0;

@@ -63,0 +69,0 @@ incrementCounter(this._counter);

@@ -16,5 +16,5 @@ import { BlockCipher } from "@stablelib/blockcipher";

clean(): this;
private fillBuffer();
private fillBuffer;
streamXOR(src: Uint8Array, dst: Uint8Array): void;
stream(dst: Uint8Array): void;
}

@@ -12,3 +12,3 @@ "use strict";

*/
var CTR = (function () {
var CTR = /** @class */ (function () {
function CTR(cipher, iv) {

@@ -25,2 +25,5 @@ this._bufpos = 0;

CTR.prototype.setCipher = function (cipher, iv) {
// Reset this._cipher to prevent reusing the existing one,
// if this method throws.
this._cipher = undefined;
if (iv.length !== this._counter.length) {

@@ -42,3 +45,5 @@ throw new Error("CTR: iv length must be equal to cipher block size");

this._bufpos = this._buffer.length;
// Cleaning cipher is caller's responsibility.
// Cleaning cipher is caller's responsibility,
// just remove a reference to it.
this._cipher = undefined;
return this;

@@ -45,0 +50,0 @@ };

{
"name": "@stablelib/ctr",
"version": "0.7.2",
"version": "0.8.0",
"description": "Counter block cipher mode (CTR)",

@@ -22,6 +22,7 @@ "main": "./lib/ctr.js",

"devDependencies": {
"@stablelib/aes": "^0.7.2",
"@stablelib/aes": "^0.7.3",
"@stablelib/benchmark": "^0.5.0",
"@stablelib/hex": "^0.5.0"
}
},
"gitHead": "dd08cfe89bc89b4106f0c9705db6281dd7357b26"
}

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