Socket
Socket
Sign inDemoInstall

browserify-rsa

Package Overview
Dependencies
Maintainers
5
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserify-rsa - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0

15

index.js
var bn = require('bn.js');
var randomBytes = require('randombytes');
module.exports = crt;
function blind(priv, crypto) {
var r = getr(priv, crypto);
function blind(priv) {
var r = getr(priv);
var blinder = r.toRed(bn.mont(priv.modulus))

@@ -12,4 +13,4 @@ .redPow(new bn(priv.publicExponent)).fromRed();

}
function crt(msg, priv, crypto) {
var blinds = blind(priv, crypto);
function crt(msg, priv) {
var blinds = blind(priv);
var len = priv.modulus.byteLength();

@@ -39,9 +40,9 @@ var mod = bn.mont(priv.modulus);

crt.getr = getr;
function getr(priv, crypto) {
function getr(priv) {
var len = priv.modulus.byteLength();
var r = new bn(crypto.randomBytes(len));
var r = new bn(randomBytes(len));
while (r.cmp(priv.modulus) >= 0 || !r.mod(priv.prime1) || !r.mod(priv.prime2)) {
r = new bn(crypto.randomBytes(len));
r = new bn(randomBytes(len));
}
return r;
}
{
"name": "browserify-rsa",
"version": "1.1.1",
"version": "2.0.0",
"description": "",

@@ -12,3 +12,4 @@ "main": "index.js",

"dependencies": {
"bn.js": "^1.0.0"
"bn.js": "^1.0.0",
"randombytes": "^2.0.1"
},

@@ -22,4 +23,4 @@ "repository": {

"tape": "^3.0.3",
"parse-asn1": "^1.2.0"
"parse-asn1": "^3.0.0"
}
}

@@ -19,3 +19,3 @@ var keys = [

while(i++ < len) {
var r = crt.getr(priv, crypto);
var r = crt.getr(priv);
t.equals(r.gcd(priv.modulus).toString(), '1', 'are coprime run ' + i);

@@ -49,3 +49,3 @@ }

}, buf).toString('hex');
var myEncrypt = crt(buf, priv, crypto).toString('hex');
var myEncrypt = crt(buf, priv).toString('hex');
t.equals(nodeEncrypt, myEncrypt, 'equal encrypts');

@@ -52,0 +52,0 @@ });

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