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

Method commit_decomposed

smc_range_proof/src/common.rs:47–55  ·  view source on GitHub ↗

Given `base`-ary representation of a value, commit to its `digits`, `g * (1 * digits[0] + base * digits[1] + base^2 * digits[2] + base^{n-1} * digits[n-1]) + h * randomness`

(
        &self,
        base: u16,
        digits: &[G::ScalarField],
        randomness: &G::ScalarField,
    )

Source from the content-addressed store, hash-verified

45
46 /// Given `base`-ary representation of a value, commit to its `digits`, `g * (1 * digits[0] + base * digits[1] + base^2 * digits[2] + base^{n-1} * digits[n-1]) + h * randomness`
47 pub fn commit_decomposed(
48 &self,
49 base: u16,
50 digits: &[G::ScalarField],
51 randomness: &G::ScalarField,
52 ) -> G {
53 let base_powers = powers(&G::ScalarField::from(base), digits.len() as u32);
54 self.commit_decomposed_given_base_powers(&base_powers, digits, randomness)
55 }
56
57 /// Same as `commit_decomposed` but takes `[1, base, base^2, ..., base^{n-1}]`
58 pub fn commit_decomposed_given_base_powers(

Callers 8

base_digitsFunction · 0.80
init_given_baseMethod · 0.80
init_given_baseMethod · 0.80
init_given_baseMethod · 0.80
init_given_baseMethod · 0.80
init_given_baseMethod · 0.80
init_given_baseMethod · 0.80

Calls 3

powersFunction · 0.85
lenMethod · 0.45

Tested by 1

base_digitsFunction · 0.64