PRCYCoin  2.0.0.7rc1
P2P Digital Currency
Classes | Functions | Variables
secp256k1_generator.h File Reference
#include "secp256k1_2.h"
#include <stdint.h>
Include dependency graph for secp256k1_generator.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  secp256k1_generator
 Opaque data structure that stores a base point. More...
 

Functions

SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_generator_parse (const secp256k1_context2 *ctx, secp256k1_generator *commit, const unsigned char *input) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
 Parse a 33-byte generator byte sequence into a generator object. More...
 
SECP256K1_API int secp256k1_generator_serialize (const secp256k1_context2 *ctx, unsigned char *output, const secp256k1_generator *commit) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
 Serialize a 33-byte generator into a serialized byte sequence. More...
 
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_generator_generate (const secp256k1_context2 *ctx, secp256k1_generator *gen, const unsigned char *seed32) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
 Generate a generator for the curve. More...
 
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_generator_generate_blinded (const secp256k1_context2 *ctx, secp256k1_generator *gen, const unsigned char *key32, const unsigned char *blind32) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
 Generate a blinded generator for the curve. More...
 

Variables

const SECP256K1_API secp256k1_generator secp256k1_generator_const_g
 Standard secp256k1 generator G. More...
 
const SECP256K1_API secp256k1_generator secp256k1_generator_const_h
 Alternate secp256k1 generator from Elements Alpha. More...
 

Function Documentation

◆ secp256k1_generator_generate()

SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_generator_generate ( const secp256k1_context2 ctx,
secp256k1_generator gen,
const unsigned char *  seed32 
)

Generate a generator for the curve.

Returns: 0 in the highly unlikely case the seed is not acceptable, 1 otherwise. Args: ctx: a secp256k1 context object Out: gen: a generator object In: seed32: a 32-byte seed

If successful a valid generator will be placed in gen. The produced generators are distributed uniformly over the curve, and will not have a known discrete logarithm with respect to any other generator produced, or to the base generator G.

Definition at line 231 of file main_impl.h.

◆ secp256k1_generator_generate_blinded()

SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_generator_generate_blinded ( const secp256k1_context2 ctx,
secp256k1_generator gen,
const unsigned char *  key32,
const unsigned char *  blind32 
)

Generate a blinded generator for the curve.

Returns: 0 in the highly unlikely case the seed is not acceptable or when blind is out of range. 1 otherwise. Args: ctx: a secp256k1 context object, initialized for signing Out: gen: a generator object In: seed32: a 32-byte seed blind32: a 32-byte secret value to blind the generator with.

The result is equivalent to first calling secp256k1_generator_generate, converting the result to a public key, calling secp256k1_ec_pubkey_tweak_add2, and then converting back to generator form.

Definition at line 238 of file main_impl.h.

◆ secp256k1_generator_parse()

SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_generator_parse ( const secp256k1_context2 ctx,
secp256k1_generator commit,
const unsigned char *  input 
)

Parse a 33-byte generator byte sequence into a generator object.

Returns: 1 if input contains a valid generator. Args: ctx: a secp256k1 context object. Out: commit: pointer to the output generator object In: input: pointer to a 33-byte serialized generator

Definition at line 57 of file main_impl.h.

Here is the caller graph for this function:

◆ secp256k1_generator_serialize()

SECP256K1_API int secp256k1_generator_serialize ( const secp256k1_context2 ctx,
unsigned char *  output,
const secp256k1_generator commit 
)

Serialize a 33-byte generator into a serialized byte sequence.

Returns: 1 always. Args: ctx: a secp256k1 context object. Out: output: a pointer to a 33-byte byte array In: commit: a pointer to a generator

Definition at line 77 of file main_impl.h.

Variable Documentation

◆ secp256k1_generator_const_g

const SECP256K1_API secp256k1_generator secp256k1_generator_const_g

Standard secp256k1 generator G.

Standard secp256k1 generator G.

Definition at line 18 of file main_impl.h.

◆ secp256k1_generator_const_h

const SECP256K1_API secp256k1_generator secp256k1_generator_const_h

Alternate secp256k1 generator from Elements Alpha.

Alternate secp256k1 generator from Elements Alpha.

Computed as the hash of the above G, DER-encoded with 0x04 (uncompressed pubkey) as its flag byte. import hashlib C = EllipticCurve ([F (0), F (7)]) G_bytes = '0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8'.decode('hex') H = C.lift_x(int(hashlib.sha256(G_bytes).hexdigest(),16))

Definition at line 32 of file main_impl.h.