includes/clientside/static/enanomath.js
author Dan
Sat, 01 Mar 2008 18:59:11 -0500
changeset 469 3f11279bac50
parent 436 242353360e37
permissions -rw-r--r--
Oops. Forgot to add the themepreview.png file which is a dummy icon for themes that don't include screenshots. Also in last commit several changes weren't documented, including: Moved several page manipulation functions from PageUtils to PageProcess. Fixed debug message in l10n.js. Started switchover to new rollback API and log_id column replacing time_id as key.

/*
 * EnanoMath, an abstraction layer for big-integer (arbitrary precision)
 * mathematics.
 */

var EnanoMathLayers = {};

// EnanoMath layer: Leemon (frontend to BigInt library by Leemon Baird)

EnanoMathLayers.Leemon = {
  Base: 10,
  PowMod: function(a, b, c)
  {
    a = str2bigInt(a, this.Base);
    b = str2bigInt(b, this.Base);
    c = str2bigInt(c, this.Base);
    var result = powMod(a, b, c);
    result = bigInt2str(result, this.Base);
    return result;
  },
  RandomInt: function(bits)
  {
    var result = randBigInt(bits);
    return bigInt2str(result, this.Base);
  }
}

var EnanoMath = EnanoMathLayers.Leemon;