9#ifndef BOTAN_ED25519_SCALAR_H_
10#define BOTAN_ED25519_SCALAR_H_
12#include <botan/types.h>
28 static constexpr size_t WORDS = 32 /
sizeof(
word);
31 static constexpr size_t BYTES = 32;
33 static Ed25519_Scalar
zero() {
return Ed25519_Scalar(std::array<word, WORDS>{}); }
35 static Ed25519_Scalar
one() {
return Ed25519_Scalar(std::array<word, WORDS>{1}); }
40 static Ed25519_Scalar from_bytes(std::span<const uint8_t, BYTES> b);
46 static Ed25519_Scalar from_wide_bytes(std::span<const uint8_t, 2 * BYTES> b);
52 static std::optional<Ed25519_Scalar> from_canonical_bytes(std::span<const uint8_t, BYTES> b);
57 void serialize_to(std::span<uint8_t, BYTES> b)
const;
60 std::array<uint8_t, BYTES> b;
72 explicit Ed25519_Scalar(
const std::array<word, WORDS>& v) : m_val(v) {}
74 std::array<word, WORDS> m_val;
static constexpr size_t BYTES
static Ed25519_Scalar zero()
std::array< uint8_t, BYTES > to_bytes() const
static Ed25519_Scalar one()
void serialize_to(std::span< uint8_t, BYTES > b) const
BigInt operator*(const BigInt &x, const BigInt &y)
OctetString operator+(const OctetString &k1, const OctetString &k2)
BigInt operator-(const BigInt &x, const BigInt &y)
std::conditional_t< HasNative64BitRegisters, std::uint64_t, uint32_t > word
The native machine word, used as the limb type for multiprecision integers.