a zip code crypto-currency system good for red ONLY

withPublic.js 231B

12345678910
  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. module.exports = withPublic;