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

Method commit_to_a_batch

utils/src/commitment.rs:42–56  ·  view source on GitHub ↗

Commit to a batch of messages and output commitments corresponding to each message.

(
        &self,
        messages: &[G::ScalarField],
        randomness: &[G::ScalarField],
    )

Source from the content-addressed store, hash-verified

40
41 /// Commit to a batch of messages and output commitments corresponding to each message.
42 pub fn commit_to_a_batch(
43 &self,
44 messages: &[G::ScalarField],
45 randomness: &[G::ScalarField],
46 ) -> Vec<G> {
47 assert_eq!(messages.len(), randomness.len());
48 let g_table = WindowTable::new(messages.len(), self.g.into_group());
49 let h_table = WindowTable::new(randomness.len(), self.h.into_group());
50 G::Group::normalize_batch(
51 &cfg_into_iter!(messages)
52 .zip(cfg_into_iter!(randomness))
53 .map(|(m_i, r_i)| &g_table * m_i + &h_table * r_i)
54 .collect::<Vec<_>>(),
55 )
56 }
57
58 pub fn commit_as_projective(
59 &self,

Callers 1

deal_secretFunction · 0.80

Calls 2

mapMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected