Dart DocumentationbignumClassic

Classic class

Modular reduction using "classic" algorithm on BigInteger

class Classic {

 BigInteger m;

 Classic(this.m);
 convert(x) {
   if(x.s < 0 || x.compareTo(this.m) >= 0) { return x.mod(this.m);
   } else { return x;
   }
 }
 revert(x) { return x; }
 reduce(x) { x.divRemTo(this.m,null,x); }
 mulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
 sqrTo(x,r) { x.squareTo(r); this.reduce(r); }
}

Constructors

new Classic(BigInteger m) #

Classic(this.m);

Properties

BigInteger m #

m

Methods

convert(x) #

convert(x) {
 if(x.s < 0 || x.compareTo(this.m) >= 0) { return x.mod(this.m);
 } else { return x;
 }
}

mulTo(x, y, r) #

mulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }

reduce(x) #

reduce(x) { x.divRemTo(this.m,null,x); }

revert(x) #

revert(x) { return x; }

sqrTo(x, r) #

sqrTo(x,r) { x.squareTo(r); this.reduce(r); }