MCPcopy Create free account
hub / github.com/docknetwork/crypto / commitment_key

Method commitment_key

saver/src/commitment.rs:81–92  ·  view source on GitHub ↗

Commitment key (vector of all `g`s and `h`) for the chunked commitment Given a group element `g`, create `chunks_count` multiples of `g` as `g_n, g_{n-1}, ..., g_2, g_1` where each `g_i = {radix^i} * g` and `radix = 2^chunk_bit_ize`

(gens: &ChunkedCommitmentGens<G>, chunk_bit_size: u8)

Source from the content-addressed store, hash-verified

79 /// Commitment key (vector of all `g`s and `h`) for the chunked commitment
80 /// Given a group element `g`, create `chunks_count` multiples of `g` as `g_n, g_{n-1}, ..., g_2, g_1` where each `g_i = {radix^i} * g` and `radix = 2^chunk_bit_ize`
81 pub fn commitment_key(gens: &ChunkedCommitmentGens<G>, chunk_bit_size: u8) -> Vec<G> {
82 let radix = (1 << chunk_bit_size) as u64;
83 let chunks = chunks_count::<G::ScalarField>(chunk_bit_size);
84 let gs = if radix.is_power_of_two() {
85 Self::commitment_key_for_radix_power_of_2(gens.G.into_group(), chunks, radix)
86 } else {
87 Self::commitment_key_for_radix_non_power_of_2(gens.G.into_group(), chunks, radix)
88 };
89 let mut ck = G::Group::normalize_batch(&gs);
90 ck.push(gens.H);
91 ck
92 }
93
94 fn get_values_to_commit(
95 message: &G::ScalarField,

Callers 4

encryption_comm_keyMethod · 0.80
checkFunction · 0.80
checkFunction · 0.80

Calls

no outgoing calls

Tested by 1

checkFunction · 0.64