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

bcrypto

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bcrypto - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

23

lib/aead.js

@@ -27,2 +27,3 @@ /*!

this.cipherLen = 0;
this.hasCipher = false;
this.polyKey = null;

@@ -38,4 +39,3 @@ }

init(key, iv) {
const polyKey = Buffer.allocUnsafe(32);
polyKey.fill(0);
const polyKey = Buffer.alloc(32, 0x00);

@@ -48,3 +48,3 @@ this.chacha20.init(key, iv);

// to get the cipher in the correct state.
this.chacha20.encrypt(Buffer.allocUnsafe(32));
this.chacha20.encrypt(Buffer.alloc(32, 0x00));

@@ -59,2 +59,3 @@ // Counter should be one.

this.cipherLen = 0;
this.hasCipher = false;
}

@@ -69,3 +70,3 @@

aad(data) {
assert(this.cipherLen === 0, 'Cannot update aad.');
assert(!this.hasCipher, 'Cannot update aad.');
this.poly1305.update(data);

@@ -81,3 +82,3 @@ this.aadLen += data.length;

encrypt(data) {
if (this.cipherLen === 0)
if (!this.hasCipher)
this.pad16(this.aadLen);

@@ -87,3 +88,5 @@

this.poly1305.update(data);
this.cipherLen += data.length;
this.hasCipher = true;

@@ -99,6 +102,8 @@ return data;

decrypt(data) {
if (this.cipherLen === 0)
if (!this.hasCipher)
this.pad16(this.aadLen);
this.cipherLen += data.length;
this.hasCipher = true;
this.poly1305.update(data);

@@ -116,6 +121,8 @@ this.chacha20.encrypt(data);

auth(data) {
if (this.cipherLen === 0)
if (!this.hasCipher)
this.pad16(this.aadLen);
this.cipherLen += data.length;
this.hasCipher = true;
this.poly1305.update(data);

@@ -148,3 +155,3 @@

if (this.cipherLen === 0)
if (!this.hasCipher)
this.pad16(this.aadLen);

@@ -151,0 +158,0 @@

@@ -12,3 +12,2 @@ /*!

const aes = require('./aes');
const siphash = require('./siphash');

@@ -39,9 +38,2 @@ exports.AEAD = require('./aead');

exports.SHA512 = require('./sha512');
exports.siphash = siphash.siphash;
exports.siphash256 = siphash.siphash256; // compat
exports.siphash32 = siphash.siphash32;
exports.siphash64 = siphash.siphash64;
exports.siphash32k256 = siphash.siphash32k256;
exports.siphash64k256 = siphash.siphash64k256;
exports.sipmod = siphash.sipmod;

@@ -48,0 +40,0 @@ exports.get = digest.get;

@@ -155,3 +155,3 @@ /*!

for (let i = 0; i < this.size; i++)
out[i] = this.state[i >> 2] >> (8 * (i & 3));
out[i] = this.state[i >>> 2] >>> (8 * (i & 3));

@@ -158,0 +158,0 @@ for (let i = 0; i < 16; i++)

@@ -128,3 +128,3 @@ /*!

for (let i = 0; i < len; i++)
out[i] = this.state[i >> 2] >> (8 * (i & 3));
out[i] = this.state[i >>> 2] >>> (8 * (i & 3));

@@ -131,0 +131,0 @@ for (let i = 0; i < 50; i++)

@@ -95,4 +95,3 @@ /*!

ec.ecdh = function ecdh(pub, priv) {
const point = secp256k1.ecdhUnsafe(pub, priv, true);
return point.slice(1, 33);
return secp256k1.ecdhUnsafe(pub, priv, true);
};

@@ -99,0 +98,0 @@

{
"name": "bcrypto",
"version": "0.1.0",
"version": "0.2.0",
"description": "Bcoin crypto module",

@@ -30,4 +30,4 @@ "keywords": [

"bindings": "~1.3.0",
"nan": "~2.8.0",
"secp256k1": "3.4.0"
"nan": "~2.9.2",
"secp256k1": "3.5.0"
},

@@ -37,10 +37,10 @@ "devDependencies": {

"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.6.1",
"browserify": "^14.5.0",
"eslint": "^4.14.0",
"mocha": "^4.0.1",
"uglifyjs-webpack-plugin": "^1.1.5",
"uglify-es": "^3.1.3",
"webpack": "^3.10.0"
"browserify": "^16.1.1",
"eslint": "^4.18.2",
"mocha": "^5.0.4",
"uglifyjs-webpack-plugin": "^1.2.3",
"uglify-es": "^3.3.9",
"webpack": "^4.1.1"
},

@@ -68,4 +68,3 @@ "engines": {

"./lib/sha3": "./lib/sha3-browser.js",
"./lib/sha512": "./lib/sha512-browser.js",
"./lib/siphash": "./lib/siphash-browser.js"
"./lib/sha512": "./lib/sha512-browser.js"
},

@@ -72,0 +71,0 @@ "browserify": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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