Module dock_crypto_utils::randomized_pairing_check

source ·
Expand description

An efficient way to check several equality relations involving pairings by combining the relations in a random linear combination and doing a multi-pairing check. Relies on Schwartz–Zippel lemma.

Structs§

  • Inspired from Snarkpack implementation - https://github.com/nikkolasg/snarkpack/blob/main/src/pairing_check.rs RandomizedPairingChecker represents a check of the form e(A,B)e(C,D)... = T. Checks can be aggregated together using random linear combination. The efficiency comes from keeping the results from the miller loop output before proceeding to a final exponentiation when verifying if all checks are verified. For each pairing equation, multiply by a power of a random element created during initialization eg. to check 3 pairing equations e(A1, B1) == O1, e(A2, B2) == O2 and e(A3, B3) == O3, a single equation can be checked as e(A1, B1) + e(A2, B2)*r + e(A3, B3)*r^2 == O1 + O2*r + O3*r^2 which is same as checking e(A1, B1) + e(A2*r, B2) + e(A3*r^2, B3) == O1 + O2*r + O3*r^2 Similarly to check 3 pairing equations e(A1, B1) == e(C1, D1), e(A2, B2) == e(C2, D2) and e(A3, B3) == e(C3, D3), a single check can done as e(A1, B1) + e(A2, B2)*r + e(A3, B3)*r^2 == e(C1, D1) + e(C2, D2)*r + e(C3, D3)*r^2 which is same as checking e(A1, B1) + e(A2*r, B2) + e(A3*r^2, B3) + e(C1*-1, D1) + e(C2*-r, D2) + e(C3*-r^2, D3)== 1