Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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.
 
static void mulmod (const uint64_t *in1, uint64_t *inout)
 Combine multiply9x9 and mod_m with internal temporary storage.
 
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.
 
static void powermod (const uint64_t *base, uint64_t *res, uint64_t n)
 Compute base to the n modulo m.
 

Function Documentation

◆ 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]mulproduct from multiply9x9 with 18 numbers of 64 bits each
[out]outresult 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]in1first factor with 9 numbers of 64 bits each
[in,out]inoutsecond 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]in1first factor as 9 numbers of 64 bits each
[in]in2second factor as 9 numbers of 64 bits each
[out]outresult 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]basewith 9 numbers of 64 bits each
[out]resoutput with 9 numbers of 64 bits each
[in]nexponent

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

Definition at line 229 of file mulmod.h.