aiken/crypto/bls12_381/pairing

Functions

miller_loop(q: G1Element, p: G2Element) -> MillerLoopResult

Computes a MillerLoop over the elements q and p

final_exponentiation(left: MillerLoopResult, right: MillerLoopResult) -> Bool

Final exponentiation against two MillerLoopResult.

prove: e(q^x, p^m) == e(q, p^m*x)
let secret: State<Scalar> = scalar.from_int(44203)

let public_value: G1Element = g1.generator |> g1.scale(secret)

let message: ByteArray = #"acab"

let challenge: G2Element =
  message |> g2.hash_to_group(g2.domain_separation_tag_basic)

let witness: G2Element =
  message
    |> g2.hash_to_group(g2.domain_separation_tag_basic)
    |> g2.scale(secret)

final_exponentiation(
  miller_loop(public_value, challenge),
  miller_loop(g1.generator, witness),
)
Search Document