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

@stablelib/poly1305

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stablelib/poly1305 - npm Package Compare versions

Comparing version 0.5.0 to 0.10.2

3

lib/poly1305.js

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

*/
var Poly1305 = (function () {
var Poly1305 = /** @class */ (function () {
function Poly1305(key) {

@@ -358,3 +358,2 @@ this.digestLength = exports.DIGEST_LENGTH;

this._leftover = 0;
return this;
}

@@ -361,0 +360,0 @@ if (bytes >= 16) {

@@ -6,2 +6,3 @@ "use strict";

var hex_1 = require("@stablelib/hex");
var bytes_1 = require("@stablelib/bytes");
var poly1305_1 = require("./poly1305");

@@ -258,3 +259,26 @@ var testVectors = [

});
it('multiple update should produce the same result as a single update', function () {
var key = new Uint8Array(32);
for (var i = 0; i < key.length; i++) {
key[i] = i;
}
var data = new Uint8Array(4 + 64 + 169);
for (var i = 0; i < data.length; i++) {
data[i] = i;
}
var d1 = data.subarray(0, 4);
var d2 = data.subarray(4, 4 + 64);
var d3 = data.subarray(4 + 64);
expect(hex_1.encode(bytes_1.concat(d1, d2, d3))).toBe(hex_1.encode(data));
var p1 = new poly1305_1.Poly1305(key);
p1.update(data);
var r1 = p1.digest();
var p2 = new poly1305_1.Poly1305(key);
p2.update(d1);
p2.update(d2);
p2.update(d3);
var r2 = p2.digest();
expect(hex_1.encode(r1)).toBe(hex_1.encode(r2));
});
});
//# sourceMappingURL=poly1305.test.js.map
{
"name": "@stablelib/poly1305",
"version": "0.5.0",
"version": "0.10.2",
"description": "Poly1305 one-time message authentication code",

@@ -23,4 +23,5 @@ "main": "./lib/poly1305.js",

"@stablelib/benchmark": "^0.5.0",
"@stablelib/bytes": "^0.5.0",
"@stablelib/hex": "^0.5.0"
}
}

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

import { encode, decode } from "@stablelib/hex";
import { oneTimeAuth } from "./poly1305";
import { concat } from "@stablelib/bytes";
import { oneTimeAuth, Poly1305 } from "./poly1305";

@@ -260,2 +261,29 @@ const testVectors = [

});
it('multiple update should produce the same result as a single update', () => {
const key = new Uint8Array(32);
for (let i = 0; i < key.length; i++) {
key[i] = i;
}
const data = new Uint8Array(4 + 64 + 169);
for (let i = 0; i < data.length; i++) {
data[i] = i;
}
const d1 = data.subarray(0, 4);
const d2 = data.subarray(4, 4 + 64);
const d3 = data.subarray(4 + 64);
expect(encode(concat(d1, d2, d3))).toBe(encode(data));
const p1 = new Poly1305(key);
p1.update(data);
const r1 = p1.digest();
const p2 = new Poly1305(key);
p2.update(d1);
p2.update(d2);
p2.update(d3);
const r2 = p2.digest();
expect(encode(r1)).toBe(encode(r2));
});
});

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

this._leftover = 0;
return this;
}

@@ -375,0 +374,0 @@

Sorry, the diff of this file is not supported yet

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