MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / mont_init

Function mont_init

modules/crypt/arith/xsBigIntEx.c:397–410  ·  view source on GitHub ↗

* Montgomery method */

Source from the content-addressed store, hash-verified

395 * Montgomery method
396 */
397txU4 mont_init(txBigInt *m)
398{
399 txU4 a = m->data[0];
400 txU4 x, s, d;
401 int n;
402
403 x = 1;
404 for (n = mxBigIntWordSize - 1, s = 2; --n >= 0; s <<= 1) {
405 d = a * x;
406 if (d & s)
407 x += s;
408 }
409 return ~x + 1;
410}
411
412txBigInt *mont_reduction(txMachine *the, txBigInt *r, txBigInt *a, txBigInt *m, txU4 u, pool_t *pool)
413{

Callers 3

fxBigInt_mont_exp_LRFunction · 0.85
fxBigInt_mont_exp_SWFunction · 0.85
get_ec_paramFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected