Beta 7 with some repo names changed.
This commit is contained in:
1 parent
0f7b40cca7
commit
963c19493a
3408 files changed
+462217
-15516
No files matched your search
+35
@@ -0,0 +1,35 @@
|
||||
var BN = require('bn.js')
|
||||
var randomBytes = require('randombytes')
|
||||
|
||||
function blind (priv) {
|
||||
var r = getr(priv)
|
||||
var blinder = r.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed()
|
||||
return { blinder: blinder, unblinder: r.invm(priv.modulus) }
|
||||
}
|
||||
|
||||
function getr (priv) {
|
||||
var len = priv.modulus.byteLength()
|
||||
var r
|
||||
do {
|
||||
r = new BN(randomBytes(len))
|
||||
} while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2))
|
||||
return r
|
||||
}
|
||||
|
||||
function crt (msg, priv) {
|
||||
var blinds = blind(priv)
|
||||
var len = priv.modulus.byteLength()
|
||||
var blinded = new BN(msg).mul(blinds.blinder).umod(priv.modulus)
|
||||
var c1 = blinded.toRed(BN.mont(priv.prime1))
|
||||
var c2 = blinded.toRed(BN.mont(priv.prime2))
|
||||
var qinv = priv.coefficient
|
||||
var p = priv.prime1
|
||||
var q = priv.prime2
|
||||
var m1 = c1.redPow(priv.exponent1).fromRed()
|
||||
var m2 = c2.redPow(priv.exponent2).fromRed()
|
||||
var h = m1.isub(m2).imul(qinv).umod(p).imul(q)
|
||||
return m2.iadd(h).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(Buffer, 'be', len)
|
||||
}
|
||||
crt.getr = getr
|
||||
|
||||
module.exports = crt
|
||||
+3540
File diff suppressed because it is too large.
Load diff
+70
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"_from": "bn.js@^5.0.0",
|
||||
"_id": "bn.js@5.1.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==",
|
||||
"_location": "/browserify-rsa/bn.js",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "bn.js@^5.0.0",
|
||||
"name": "bn.js",
|
||||
"escapedName": "bn.js",
|
||||
"rawSpec": "^5.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/browserify-rsa"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.3.tgz",
|
||||
"_shasum": "beca005408f642ebebea80b042b4d18d2ac0ee6b",
|
||||
"_spec": "bn.js@^5.0.0",
|
||||
"_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\BackendServers\\node_modules\\browserify-rsa",
|
||||
"author": {
|
||||
"name": "Fedor Indutny",
|
||||
"email": "fedor@indutny.com"
|
||||
},
|
||||
"browser": {
|
||||
"buffer": false
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/indutny/bn.js/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Big number implementation in pure javascript",
|
||||
"devDependencies": {
|
||||
"babel-eslint": "^10.0.3",
|
||||
"mocha": "^7.0.1",
|
||||
"standardx": "^5.0.0"
|
||||
},
|
||||
"files": [
|
||||
"lib/bn.js"
|
||||
],
|
||||
"homepage": "https://github.com/indutny/bn.js",
|
||||
"keywords": [
|
||||
"BN",
|
||||
"Big number",
|
||||
"BigNum",
|
||||
"Modulo",
|
||||
"Montgomery"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/bn.js",
|
||||
"name": "bn.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/indutny/bn.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "standardx",
|
||||
"test": "npm run lint && npm run unit",
|
||||
"unit": "mocha --reporter=spec test/*-test.js"
|
||||
},
|
||||
"standardx": {
|
||||
"parser": "babel-eslint"
|
||||
},
|
||||
"version": "5.1.3"
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "browserify-rsa",
|
||||
"version": "4.1.0",
|
||||
"description": "RSA for browserify",
|
||||
"bugs": {
|
||||
"url": "https://github.com/crypto-browserify/browserify-rsa/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com:crypto-browserify/browserify-rsa.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "standard",
|
||||
"test": "npm run lint && npm run unit",
|
||||
"unit": "tape test/*.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"bn.js": "^5.0.0",
|
||||
"randombytes": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"parse-asn1": "^5.0.0",
|
||||
"standard": "^6.0.8",
|
||||
"tape": "^4.5.1"
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz"
|
||||
,"_integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog=="
|
||||
,"_from": "browserify-rsa@^4.0.1"
|
||||
}
|
||||
Reference in new issue
Block a user