barretenberg
Loading...
Searching...
No Matches
ecdsa_secp256k1.hpp
1#pragma once
2#include "barretenberg/crypto/ecdsa/ecdsa.hpp"
3#include "barretenberg/dsl/types.hpp"
4#include "barretenberg/serialize/msgpack.hpp"
5#include <vector>
6
7namespace acir_format {
8
10 // This is the byte representation of the hashed message.
11 std::vector<uint32_t> hashed_message;
12
13 // This is the computed signature
14 //
15 std::vector<uint32_t> signature;
16
17 // This is the supposed public key which signed the
18 // message, giving rise to the signature.
19 // Since Fr does not have enough bits to represent
20 // the prime field in secp256k1, a byte array is used.
21 // Can also use low and hi where lo=128 bits
22 std::vector<uint32_t> pub_x_indices;
23 std::vector<uint32_t> pub_y_indices;
24
25 // This is the result of verifying the signature
26 uint32_t result;
27
28 // for serialization, update with any new fields
29 MSGPACK_FIELDS(hashed_message, signature, pub_x_indices, pub_y_indices, result);
30 friend bool operator==(EcdsaSecp256k1Constraint const& lhs, EcdsaSecp256k1Constraint const& rhs) = default;
31};
32
33template <typename Builder>
34void create_ecdsa_k1_verify_constraints(Builder& builder,
35 const EcdsaSecp256k1Constraint& input,
36 bool has_valid_witness_assignments = true);
37
38template <typename Builder> void dummy_ecdsa_constraint(Builder& builder, EcdsaSecp256k1Constraint const& input);
39
40template <typename Builder>
41crypto::ecdsa::signature ecdsa_convert_signature(Builder& builder, std::vector<uint32_t> signature);
42witness_ct ecdsa_index_to_witness(Builder& builder, uint32_t index);
43template <typename Builder>
44proof_system::plonk::stdlib::byte_array<Builder> ecdsa_vector_of_bytes_to_byte_array(
45 Builder& builder, std::vector<uint32_t> vector_of_bytes);
46
47} // namespace acir_format
Definition: ultra_circuit_builder.hpp:31
Definition: byte_array.hpp:9
Definition: witness.hpp:10
Definition: ecdsa_secp256k1.hpp:9
Definition: ecdsa.hpp:20