aswi2020vldc-gitlab/templetes/node_modules/public-encrypt/withPublic.js @ 0b434236
1 |
var BN = require('bn.js') |
---|---|
2 |
var Buffer = require('safe-buffer').Buffer |
3 |
|
4 |
function withPublic (paddedMsg, key) { |
5 |
return Buffer.from(paddedMsg |
6 |
.toRed(BN.mont(key.modulus)) |
7 |
.redPow(new BN(key.publicExponent)) |
8 |
.fromRed() |
9 |
.toArray()) |
10 |
}
|
11 |
|
12 |
module.exports = withPublic |