oc-mint/src/big_int.hpp

28 lines
626 B
C++
Raw Permalink Normal View History

2023-04-20 22:55:17 +02:00
#ifndef OC_ISSUER_BIG_INT_HPP
#define OC_ISSUER_BIG_INT_HPP
2022-12-05 23:39:56 +01:00
#include <string>
#include <array>
#include "tl/expected.hpp"
struct BigInt {
BigInt() : data() {}
2023-04-20 22:55:17 +02:00
virtual ~BigInt() = default;
2022-12-05 23:39:56 +01:00
enum class eError : uint8_t { PARSE_ERROR };
static tl::expected<BigInt, eError> from_string(const std::string &str);
static BigInt from_int(uint64_t value);
2023-04-20 22:55:17 +02:00
[[nodiscard]] std::string to_string() const;
2022-12-05 23:39:56 +01:00
friend bool operator == (const BigInt& rhs, const BigInt& lhs);
private:
2023-04-20 22:55:17 +02:00
std::array<uint8_t,256U> data;
2022-12-05 23:39:56 +01:00
};
bool operator==(const BigInt &rhs, const BigInt &lhs);
2023-04-20 22:55:17 +02:00
#endif // #ifndef #ifndef OC_ISSUER_BIG_INT_HPP