Botan 3.6.1
Crypto and TLS for C&
|
Representation of a scalar for X448. More...
#include <curve448_scalar.h>
Public Member Functions | |
bool | get_bit (size_t i) const |
Access the i-th bit of the scalar. From 0 (lsb) to 445 (msb). | |
Scalar448 | operator* (const Scalar448 &other) const |
scalar = (scalar * other) mod L | |
Scalar448 | operator+ (const Scalar448 &other) const |
scalar = (scalar + other) mod L | |
Scalar448 (std::span< const uint8_t > x) | |
Construct a new scalar from (max. 114) bytes. Little endian. | |
template<size_t S = BYTES> requires (S >= BYTES) | |
std::array< uint8_t, S > | to_bytes () const |
Convert the scalar to bytes in little endian. | |
Static Public Member Functions | |
static bool | bytes_are_reduced (std::span< const uint8_t > x) |
Static Public Attributes | |
static constexpr size_t | BYTES = ceil_tobytes(446) |
static constexpr size_t | WORDS = words_for_bits(446) |
Representation of a scalar for X448.
The scalar is an element in 0 <= s < L, where L is the group order of X448. The constructor and all operations on scalars reduce the element mod L internally. All operations are constant time.
L = 2^446 - 13818066809895115352007386748515426880336692474882178609894547503885 (RFC 7748 4.2)
Definition at line 34 of file curve448_scalar.h.
Botan::Scalar448::Scalar448 | ( | std::span< const uint8_t > | x | ) |
Construct a new scalar from (max. 114) bytes. Little endian.
Definition at line 147 of file curve448_scalar.cpp.
References BOTAN_ARG_CHECK, and Botan::copy_mem().
Referenced by operator*(), and operator+().
|
static |
Definition at line 185 of file curve448_scalar.cpp.
References Botan::CT::all_zeros(), BOTAN_ARG_CHECK, BYTES, and Botan::CT::Mask< T >::expand().
Referenced by Botan::verify_signature().
bool Botan::Scalar448::get_bit | ( | size_t | i | ) | const |
Access the i-th bit of the scalar. From 0 (lsb) to 445 (msb).
Definition at line 156 of file curve448_scalar.cpp.
References BOTAN_ARG_CHECK.
Referenced by Botan::Ed448Point::scalar_mul().
scalar = (scalar * other) mod L
Definition at line 168 of file curve448_scalar.cpp.
References Botan::bigint_mul(), and Scalar448().
scalar = (scalar + other) mod L
Definition at line 162 of file curve448_scalar.cpp.
References Scalar448().
|
inline |
Convert the scalar to bytes in little endian.
Definition at line 44 of file curve448_scalar.h.
References Botan::store_le().
|
staticconstexpr |
Definition at line 37 of file curve448_scalar.h.
Referenced by bytes_are_reduced().
|
staticconstexpr |
Definition at line 36 of file curve448_scalar.h.