Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/browserify-rsa/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 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
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0046 ]-- |