Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
big_integer.hpp
Go to the documentation of this file.
1#pragma once
2
3// BigInteger — arbitrary-precision integer for cryptographic operations.
4// Wraps Mbed TLS MPI (Multi-Precision Integer) for RSA key operations.
5
6#include <string>
7#include <string_view>
8#include <vector>
9#include <cstdint>
10#include <optional>
11
12namespace pulp::runtime {
13
16public:
18 BigInteger(uint64_t value);
22
25
27 static BigInteger from_string(std::string_view decimal);
28
30 static BigInteger from_hex(std::string_view hex);
31
33 std::string to_string() const;
34
36 std::string to_hex() const;
37
39 bool is_zero() const;
40
42 size_t bit_count() const;
43
48
51 BigInteger mod_pow(const BigInteger& exp, const BigInteger& modulus) const;
52
54 bool operator==(const BigInteger& other) const;
55 bool operator!=(const BigInteger& other) const;
56 bool operator<(const BigInteger& other) const;
57
58private:
59 struct Impl;
60 Impl* impl_;
61};
62
63} // namespace pulp::runtime
BigInteger mod_pow(const BigInteger &exp, const BigInteger &modulus) const
Modular exponentiation: (this^exp) mod modulus Used for RSA encrypt/decrypt.
BigInteger operator%(const BigInteger &other) const
BigInteger(const BigInteger &other)
size_t bit_count() const
Number of bits needed to represent this value.
bool operator==(const BigInteger &other) const
Comparison.
bool operator<(const BigInteger &other) const
static BigInteger from_string(std::string_view decimal)
Parse from decimal string.
std::string to_string() const
Convert to decimal string.
BigInteger & operator=(BigInteger &&other) noexcept
bool is_zero() const
Whether this is zero.
static BigInteger from_hex(std::string_view hex)
Parse from hex string.
BigInteger(uint64_t value)
BigInteger operator+(const BigInteger &other) const
Arithmetic operations.
BigInteger & operator=(const BigInteger &other)
bool operator!=(const BigInteger &other) const
std::string to_hex() const
Convert to hex string.
BigInteger operator*(const BigInteger &other) const
BigInteger(BigInteger &&other) noexcept
Definition generated_event_source.hpp:33
@ other
Definition udev_monitor.hpp:26