How to use the red function from bn.js

Find comprehensive JavaScript bn.js.red code examples handpicked from public code repositorys.

57
58
59
60
61
62
63
64
65
66
function BaseCurve(type, conf) {
  this.type = type;
  this.p = new BN(conf.p, 16);

  // Use Montgomery, when there is no fast reduction for the prime
  this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p);

  // Useful for many curves
  this.zero = new BN(0).toRed(this.red);
  this.one = new BN(1).toRed(this.red);
fork icon10
star icon22
watch icon8