mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-02-18 07:46:33 +00:00
fix verifyPairings implementation
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
9cc92f117f
commit
ddb613249a
@ -134,7 +134,7 @@ proc ec_hash_to_g1*(dst: var ec_p1,
|
|||||||
|
|
||||||
proc verifyPairings*(a1: ec_p1, a2: ec_p2, b1: ec_p1, b2: ec_p2) : bool =
|
proc verifyPairings*(a1: ec_p1, a2: ec_p2, b1: ec_p1, b2: ec_p2) : bool =
|
||||||
when C.getEmbeddingDegree() == 12:
|
when C.getEmbeddingDegree() == 12:
|
||||||
var gt {.noInit.}: Fp12[C]
|
var gt1, gt2 {.noInit.}: Fp12[C]
|
||||||
else:
|
else:
|
||||||
{.error: "Not implemented: signature on k=" & $C.getEmbeddingDegree() & " for curve " & $$C.}
|
{.error: "Not implemented: signature on k=" & $C.getEmbeddingDegree() & " for curve " & $$C.}
|
||||||
|
|
||||||
@ -144,8 +144,9 @@ proc verifyPairings*(a1: ec_p1, a2: ec_p2, b1: ec_p1, b2: ec_p2) : bool =
|
|||||||
b1aff.affine(b1)
|
b1aff.affine(b1)
|
||||||
a2aff.affine(a2)
|
a2aff.affine(a2)
|
||||||
b2aff.affine(b2)
|
b2aff.affine(b2)
|
||||||
gt.pairing([a2aff, b2aff], [a1aff, b1aff])
|
gt1.pairing(a2aff, a1aff)
|
||||||
return gt.isOne().bool()
|
gt2.pairing(b2aff, b1aff)
|
||||||
|
return bool(gt1 == gt2)
|
||||||
|
|
||||||
func ec_from_bytes*(
|
func ec_from_bytes*(
|
||||||
dst: var Signature,
|
dst: var Signature,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user