 ROOT   Reference Guide mulmod.h File Reference
#include "helpers.h"
#include <cstdint>
Include dependency graph for mulmod.h:
This graph shows which files directly or indirectly include this file:

## Functions

static void mod_m (const uint64_t *mul, uint64_t *out)
Compute a value congruent to mul modulo m less than 2 ** 576. More...

static void mulmod (const uint64_t *in1, uint64_t *inout)
Combine multiply9x9 and mod_m with internal temporary storage. More...

static void multiply9x9 (const uint64_t *in1, const uint64_t *in2, uint64_t *out)
Multiply two 576 bit numbers, stored as 9 numbers of 64 bits each. More...

static void powermod (const uint64_t *base, uint64_t *res, uint64_t n)
Compute base to the n modulo m. More...

## ◆ mod_m()

 static void mod_m ( const uint64_t * mul, uint64_t * out )
static

Compute a value congruent to mul modulo m less than 2 ** 576.

Parameters
 [in] mul product from multiply9x9 with 18 numbers of 64 bits each [out] out result with 9 numbers of 64 bits each

$$m = 2^{576} - 2^{240} + 1$$

The result in out is guaranteed to be smaller than the modulus.

Definition at line 138 of file mulmod.h.

## ◆ mulmod()

 static void mulmod ( const uint64_t * in1, uint64_t * inout )
static

Combine multiply9x9 and mod_m with internal temporary storage.

Parameters
 [in] in1 first factor with 9 numbers of 64 bits each [in,out] inout second factor and also the output of the same size

The result in inout is guaranteed to be smaller than the modulus.

Definition at line 215 of file mulmod.h.

## ◆ multiply9x9()

 static void multiply9x9 ( const uint64_t * in1, const uint64_t * in2, uint64_t * out )
static

Multiply two 576 bit numbers, stored as 9 numbers of 64 bits each.

Parameters
 [in] in1 first factor as 9 numbers of 64 bits each [in] in2 second factor as 9 numbers of 64 bits each [out] out result with 18 numbers of 64 bits each

Definition at line 24 of file mulmod.h.

## ◆ powermod()

 static void powermod ( const uint64_t * base, uint64_t * res, uint64_t n )
static

Compute base to the n modulo m.

Parameters
 [in] base with 9 numbers of 64 bits each [out] res output with 9 numbers of 64 bits each [in] n exponent

The arguments base and res may point to the same location.

Definition at line 229 of file mulmod.h.