18 return Bytes(input.begin(), input.end());
24 out.insert(out.end(), tag.begin(), tag.end());
25 out.insert(out.end(), input.begin(), input.end());
30 for (
int i = 0; i < 4; ++i) {
31 out.push_back(
static_cast<unsigned char>((value >> (8 * i)) & 0xffU));
35inline std::optional<std::uint32_t>
read_u32_le(std::span<const unsigned char> bytes,
37 std::uint32_t value = 0;
38 if (offset > bytes.size() || bytes.size() - offset < 4) {
41 for (
int i = 0; i < 4; ++i) {
42 value |=
static_cast<std::uint32_t
>(bytes[offset + i]) << (8 * i);
63template <
typename CircuitLike>
65 if (!circuit.has_valid_shape()) {
77template <
typename CacheLike>
79 std::string_view nonce_tag) {
84 "validate_message_proof_cache:integrity_digest");
85 if (cache.template_digest != template_digest) {
91template <
typename CacheLike>
93 std::string_view nonce_tag) {
94 if (cache.topic.empty()) {
101 "validate_topic_proof_cache:integrity_digest");
102 if (cache.template_digest != template_digest) {
Purify result carrier that either holds a value or an error.
Resettable packed circuit representation backed by one aligned owning slab.
std::size_t n_commitments() const noexcept
std::size_t n_gates() const noexcept
#define PURIFY_ASSIGN_OR_RETURN(lhs, expr, context)
Evaluates an expected-like expression, binds the value to lhs, and propagates errors.
Legacy Bulletproof-backed Purify-derived BIP340 signing helpers with prepared nonces.
std::optional< std::uint32_t > read_u32_le(std::span< const unsigned char > bytes, std::size_t offset)
Bytes tagged_eval_input(std::string_view tag, std::span< const unsigned char > input)
Status validate_topic_proof_cache(const CacheLike &cache, std::string_view nonce_tag)
void append_u32_le(Bytes &out, std::uint32_t value)
Status validate_message_proof_cache(const CacheLike &cache, std::string_view nonce_tag)
Bytes copy_bytes(std::span< const unsigned char > input)
Status validate_proof_cache_circuit(const CircuitLike &circuit, const char *context)
std::size_t circuit_n_gates(const NativeBulletproofCircuit &circuit)
std::size_t circuit_n_commitments(const NativeBulletproofCircuit &circuit)
constexpr Unexpected< Error > unexpected_error(ErrorCode code, const char *context=nullptr)
Constructs an unexpected Error value from a machine-readable code.
bool is_power_of_two_size(std::size_t value) noexcept
std::vector< unsigned char > Bytes
Dynamically sized byte string used for messages, serialized witnesses, and proofs.
void best_effort_reserve_add(std::vector< T > &out, std::size_t lhs, std::size_t rhs)
Reserve capacity when the size arithmetic fits, otherwise skip the hint.
Native in-memory representation of a Bulletproof-style arithmetic circuit.
std::size_t n_commitments