add comments
This commit is contained in:
@@ -73,6 +73,15 @@ const bn256 n25638 = { {0xffffffda, 0xffffffff, 0xffffffff, 0xffffffff,
|
|||||||
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } };
|
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } };
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implementation Note.
|
||||||
|
*
|
||||||
|
* It's not always modulo n25638. The representation is redundant
|
||||||
|
* during computation. For example, when we add the number - 1 and 1,
|
||||||
|
* it won't overflow to 2^256, and the result is represented within
|
||||||
|
* 256-bit.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief X = (A + B) mod 2^256-38
|
* @brief X = (A + B) mod 2^256-38
|
||||||
*/
|
*/
|
||||||
@@ -142,7 +151,7 @@ mod25638_mul (bn256 *X, const bn256 *A, const bn256 *B)
|
|||||||
void
|
void
|
||||||
mod25638_sqr (bn256 *X, const bn256 *A)
|
mod25638_sqr (bn256 *X, const bn256 *A)
|
||||||
{
|
{
|
||||||
/* This could be improved a bit, see mpi_montsqr. */
|
/* This could be improved a bit, see bn256_sqr. */
|
||||||
mod25638_mul (X, A, A);
|
mod25638_mul (X, A, A);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,17 @@
|
|||||||
const bn256 p256k1 = { {0xfffffc2f, 0xfffffffe, 0xffffffff, 0xffffffff,
|
const bn256 p256k1 = { {0xfffffc2f, 0xfffffffe, 0xffffffff, 0xffffffff,
|
||||||
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } };
|
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } };
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implementation Note.
|
||||||
|
*
|
||||||
|
* It's not always modulo p256k1. The representation is redundant
|
||||||
|
* during computation. For example, when we add the prime - 1 and 1,
|
||||||
|
* it won't overflow to 2^256, and the result is represented within
|
||||||
|
* 256-bit.
|
||||||
|
*
|
||||||
|
* It is guaranteed that modp256k1_reduce reduces to modulo p256k1.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief X = (A + B) mod p256k1
|
* @brief X = (A + B) mod p256k1
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -46,6 +46,17 @@
|
|||||||
const bn256 p256r1 = { {0xffffffff, 0xffffffff, 0xffffffff, 0x00000000,
|
const bn256 p256r1 = { {0xffffffff, 0xffffffff, 0xffffffff, 0x00000000,
|
||||||
0x00000000, 0x00000000, 0x00000001, 0xffffffff} };
|
0x00000000, 0x00000000, 0x00000001, 0xffffffff} };
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implementation Note.
|
||||||
|
*
|
||||||
|
* It's not always modulo p256r1. The representation is redundant
|
||||||
|
* during computation. For example, when we add the prime - 1 and 1,
|
||||||
|
* it won't overflow to 2^256, and the result is represented within
|
||||||
|
* 256-bit.
|
||||||
|
*
|
||||||
|
* It is guaranteed that modp256r1_reduce reduces to modulo p256r1.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief X = (A + B) mod p256r1
|
* @brief X = (A + B) mod p256r1
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user