28 const uint8_t* s_ptr = &signature.
s[0];
29 const uint8_t* e_ptr = &signature.
e[0];
57 hash_input.write(message);
62 static constexpr size_t HI_BYTES = 32 - LO_BYTES;
65 return { output_lo, output_hi };
80 output_lo.assert_equal(sig.
e.lo,
"verify signature failed");
81 output_hi.assert_equal(sig.
e.hi,
"verify signature failed");
95 bool_t<C> valid = (output_lo == sig.
e.lo) && (output_hi == sig.
e.hi);
99#define VERIFY_SIGNATURE_INTERNAL(circuit_type) \
100 template std::array<field_t<circuit_type>, 2> schnorr_verify_signature_internal<circuit_type>( \
101 const byte_array<circuit_type>&, \
102 const cycle_group<circuit_type>&, \
103 const schnorr_signature_bits<circuit_type>&)
106#define VERIFY_SIGNATURE(circuit_type) \
107 template void schnorr_verify_signature<circuit_type>(const byte_array<circuit_type>&, \
108 const cycle_group<circuit_type>&, \
109 const schnorr_signature_bits<circuit_type>&)
112#define SIGNATURE_VERIFICATION_RESULT(circuit_type) \
113 template bool_t<circuit_type> schnorr_signature_verification_result<circuit_type>( \
114 const byte_array<circuit_type>&, \
115 const cycle_group<circuit_type>&, \
116 const schnorr_signature_bits<circuit_type>&)
119#define CONVERT_SIGNATURE(circuit_type) \
120 template schnorr_signature_bits<circuit_type> schnorr_convert_signature<circuit_type>( \
121 circuit_type*, const crypto::schnorr_signature&)
static constexpr element one
static byte_array_ct hash(const byte_array_ct &input)
Implements boolean logic in-circuit.
Represents a dynamic array of bytes in-circuit.
byte_array slice(size_t offset) const
Slice bytes from the byte array starting at offset. Does not add any constraints.
cycle_group represents a group Element of the proving system's embedded curve i.e....
static cycle_group batch_mul(const std::vector< cycle_group > &base_points, const std::vector< BigScalarField > &scalars, GeneratorContext context={})
cycle_scalar represents a member of the cycle curve SCALAR FIELD. This is NOT the native circuit fiel...
static cycle_scalar from_witness_bitstring(Builder *context, const uint256_t &bitstring, size_t num_bits)
Use when we want to multiply a group element by a string of bits of known size. N....
stdlib class that evaluates in-circuit pedersen hashes, consistent with behavior in crypto::pedersen_...
StrictMock< MockContext > context
void read(B &it, uint256_t &value)
schnorr_signature_bits< C > schnorr_convert_signature(C *context, const crypto::schnorr_signature &signature)
Instantiate a witness containing the signature (s, e) as a quadruple of field_t elements (s_lo,...
std::array< field_t< C >, 2 > schnorr_verify_signature_internal(const byte_array< C > &message, const cycle_group< C > &pub_key, const schnorr_signature_bits< C > &sig)
Make the computations needed to verify a signature (s, e), i.e., compute e' = hash(([s]g + [e]pub)....
bool_t< C > schnorr_signature_verification_result(const byte_array< C > &message, const cycle_group< C > &pub_key, const schnorr_signature_bits< C > &sig)
Attempt to verify a signature (s, e) and return the result, i.e., compute e' = hash(([s]g + [e]pub)....
void schnorr_verify_signature(const byte_array< C > &message, const cycle_group< C > &pub_key, const schnorr_signature_bits< C > &sig)
Verify that a signature (s, e) is valid, i.e., compute e' = hash(([s]g + [e]pub).x | message) and che...
group< fq, fr, Bn254G1Params > g1
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
#define SIGNATURE_VERIFICATION_RESULT(circuit_type)
#define VERIFY_SIGNATURE(circuit_type)
#define VERIFY_SIGNATURE_INTERNAL(circuit_type)
#define CONVERT_SIGNATURE(circuit_type)
std::array< uint8_t, 32 > s
std::array< uint8_t, 32 > e
cycle_group< C >::cycle_scalar s
cycle_group< C >::cycle_scalar e