aboutsummaryrefslogtreecommitdiff
path: root/node_modules/public-encrypt/withPublic.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/public-encrypt/withPublic.js')
-rw-r--r--node_modules/public-encrypt/withPublic.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/node_modules/public-encrypt/withPublic.js b/node_modules/public-encrypt/withPublic.js
new file mode 100644
index 000000000..abdbe35c1
--- /dev/null
+++ b/node_modules/public-encrypt/withPublic.js
@@ -0,0 +1,10 @@
+var bn = require('bn.js');
+function withPublic(paddedMsg, key) {
+ return new Buffer(paddedMsg
+ .toRed(bn.mont(key.modulus))
+ .redPow(new bn(key.publicExponent))
+ .fromRed()
+ .toArray());
+}
+
+module.exports = withPublic; \ No newline at end of file