PRCYCoin  2.0.0.7rc1
P2P Digital Currency
secp256k1_commitment.h
Go to the documentation of this file.
1 #ifndef _SECP256K1_COMMITMENT_
2 # define _SECP256K1_COMMITMENT_
3 
4 # include "secp256k1_2.h"
5 # include "secp256k1_generator.h"
6 
7 # ifdef __cplusplus
8 extern "C" {
9 # endif
10 
11 #include <stdint.h>
12 
22 typedef struct {
23  unsigned char data[64];
25 
30 
39  const secp256k1_context2* ctx,
41  const unsigned char *input
43 
53  const secp256k1_context2* ctx,
54  unsigned char *output,
55  const secp256k1_pedersen_commitment* commit
57 
60 
76  const secp256k1_context2* ctx,
78  const unsigned char *blind,
79  uint64_t value,
80  const secp256k1_generator *value_gen,
81  const secp256k1_generator *blind_gen
83 
96  const secp256k1_context2* ctx,
97  unsigned char *blind_out,
98  const unsigned char * const *blinds,
99  size_t n,
100  size_t npositive
102 
120  const secp256k1_context2* ctx,
121  const secp256k1_pedersen_commitment * const* pos,
122  size_t n_pos,
123  const secp256k1_pedersen_commitment * const* neg,
124  size_t n_neg
126 
128  const secp256k1_context2* ctx,
129  const secp256k1_pedersen_commitment * const* pos,
130  size_t n_pos,
131  const secp256k1_pedersen_commitment * const* neg,
132  size_t n_neg,
135 
137  const secp256k1_context2* ctx,
138  const secp256k1_pedersen_commitment * const* pos,
139  size_t n_pos,
142 
145  unsigned char* pubkey,
146  size_t* length
148 
150  const unsigned char* pubkey,
151  size_t length,
154 
186  const secp256k1_context2* ctx,
187  const uint64_t *value,
188  const unsigned char* const* generator_blind,
189  unsigned char* const* blinding_factor,
190  size_t n_total,
191  size_t n_inputs
192 );
193 
194 # ifdef __cplusplus
195 }
196 # endif
197 
198 #endif
secp256k1_pedersen_commit
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_pedersen_commit(const secp256k1_context2 *ctx, secp256k1_pedersen_commitment *commit, const unsigned char *blind, uint64_t value, const secp256k1_generator *value_gen, const secp256k1_generator *blind_gen) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(5) SECP256K1_ARG_NONNULL(6)
Generate a Pedersen commitment.
Definition: main_impl.h:93
secp256k1_pedersen_commitment_parse
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_pedersen_commitment_parse(const secp256k1_context2 *ctx, secp256k1_pedersen_commitment *commit, const unsigned char *input) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Parse a 33-byte commitment into a commitment object.
Definition: main_impl.h:56
SECP256K1_API
#define SECP256K1_API
Definition: secp256k1_2.h:139
secp256k1_pedersen_context_initialize
void secp256k1_pedersen_context_initialize(secp256k1_context2 *ctx)
Initialize a context for usage with Pedersen commitments.
secp256k1_generator
Opaque data structure that stores a base point.
Definition: secp256k1_generator.h:20
secp256k1_generator_h
const SECP256K1_API secp256k1_generator * secp256k1_generator_h
Static constant generator 'h' maintained for historical reasons.
Definition: main_impl.h:27
secp256k1_pedersen_blind_generator_blind_sum
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_pedersen_blind_generator_blind_sum(const secp256k1_context2 *ctx, const uint64_t *value, const unsigned char *const *generator_blind, unsigned char *const *blinding_factor, size_t n_total, size_t n_inputs)
Sets the final Pedersen blinding factor correctly when the generators themselves have blinding factor...
Definition: main_impl.h:227
secp256k1_pedersen_commitment_serialize
SECP256K1_API int secp256k1_pedersen_commitment_serialize(const secp256k1_context2 *ctx, unsigned char *output, const secp256k1_pedersen_commitment *commit) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Serialize a commitment object into a serialized byte sequence.
Definition: main_impl.h:77
SECP256K1_WARN_UNUSED_RESULT
#define SECP256K1_WARN_UNUSED_RESULT
Warning attributes NONNULL is not used if SECP256K1_BUILD is set to avoid the compiler optimizing out...
Definition: secp256k1.h:35
secp256k1_pedersen_commitment_to_serialized_pubkey
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_pedersen_commitment_to_serialized_pubkey(secp256k1_pedersen_commitment *commit, unsigned char *pubkey, size_t *length) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Definition: main_impl.h:44
secp256k1_pedersen_verify_tally
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_pedersen_verify_tally(const secp256k1_context2 *ctx, const secp256k1_pedersen_commitment *const *pos, size_t n_pos, const secp256k1_pedersen_commitment *const *neg, size_t n_neg) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(4)
Verify a tally of Pedersen commitments Returns 1: commitments successfully sum to zero.
Definition: main_impl.h:154
secp256k1_context_struct2
Definition: secp256k1_types.h:15
secp256k1_pedersen_commitment
Opaque data structure that stores a Pedersen commitment.
Definition: secp256k1_commitment.h:22
secp256k1_generator.h
secp256k1_2.h
SECP256K1_ARG_NONNULL
#define SECP256K1_ARG_NONNULL(_x)
Definition: secp256k1.h:40
secp256k1_pedersen_serialized_pubkey_to_commitment
SECP256K1_API void secp256k1_pedersen_serialized_pubkey_to_commitment(const unsigned char *pubkey, size_t length, secp256k1_pedersen_commitment *commit) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(3)
Definition: main_impl.h:50
secp256k1_pedersen_commitment_sum_pos
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_pedersen_commitment_sum_pos(const secp256k1_context2 *ctx, const secp256k1_pedersen_commitment *const *pos, size_t n_pos, secp256k1_pedersen_commitment *out) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(4)
Definition: main_impl.h:205
secp256k1_pedersen_commitment_sum
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_pedersen_commitment_sum(const secp256k1_context2 *ctx, const secp256k1_pedersen_commitment *const *pos, size_t n_pos, const secp256k1_pedersen_commitment *const *neg, size_t n_neg, secp256k1_pedersen_commitment *out) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(6)
Definition: main_impl.h:175
secp256k1_pedersen_blind_sum
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_pedersen_blind_sum(const secp256k1_context2 *ctx, unsigned char *blind_out, const unsigned char *const *blinds, size_t n, size_t npositive) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Computes the sum of multiple positive and negative blinding factors.
Definition: main_impl.h:126