Skip to content

Commit b1a99d5

Browse files
author
logicalmechanism
committed
fixing test
1 parent c6de18b commit b1a99d5

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/aiken/crypto/bls12_381/pairing.ak

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ pub fn final_exponentiation(
1616
}
1717

1818
test simple_miller_loop_with_final_exponentiation() {
19-
// prove e(q^x, p^m) == e(q^m*x, p)
20-
let x: State<Scalar> = scalar.from_int(44203)
21-
let u: G1Element = g1.generator |> g1.scale(x)
22-
let m: State<Scalar> = scalar.from_bytes(#"acab")
23-
let qmx: G2Element = g2.generator |> g2.scale(x) |> g2.scale(m)
24-
let qm: G2Element = g2.scale(g2.generator, m)
25-
let left: MillerLoopResult = miller_loop(u, qm)
26-
let right: MillerLoopResult = miller_loop(g1.generator, qmx)
19+
// prove: e(q^x, p^m) == e(q, p^m*x)
20+
let secret: State<Scalar> = scalar.from_int(44203)
21+
let public_value: G1Element = g1.generator |> g1.scale(secret)
22+
let message: ByteArray = #"acab"
23+
let domain_tag: ByteArray = "BLS-TEST"
24+
let challenge: G2Element = g2.hash_to_group(message, domain_tag)
25+
let witness: G2Element =
26+
g2.hash_to_group(message, domain_tag) |> g2.scale(secret)
27+
let left: MillerLoopResult = miller_loop(public_value, challenge)
28+
let right: MillerLoopResult = miller_loop(g1.generator, witness)
2729
final_exponentiation(left, right)
2830
}

0 commit comments

Comments
 (0)