Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80540 views
1
var bn = require('bn.js');
2
function withPublic(paddedMsg, key) {
3
return new Buffer(paddedMsg
4
.toRed(bn.mont(key.modulus))
5
.redPow(new bn(key.publicExponent))
6
.fromRed()
7
.toArray());
8
}
9
10
module.exports = withPublic;
11