AI文章摘要
I wanted to [add hashing for the curve to arkworks-rs
](
https://github.com/arkworks-rs/algebra/pull/863
), and found out that it assert
the correct mapping of the generator from the isogenous curve to the target one, hence I had to find the matching generator on the iso-curve.
TLDR \
the generator is $55066263022277343669578718895168534326250603453777594175500187360389116729240, 32670510020758816978083085130507043184471273380659243275938904335757337482424$
Searching for it took me nowhere (and now you can come to this page), so that left me with finding it mathematically. Thanks a lot to the RFC authors for the reference implementation making this a straightforward task.
The reference implementation file defining this isogeny is <
https://github.com/cfrg/draft-irtf-cfrg-hash-to-curve/blob/main/poc/iso_values.sage
>. And below is a patch to print
and check the values of interest with it. (Use sage iso_values.sage
to run it.)
diff --git a/poc/iso_values.sage b/poc/iso_values.sage
index 4a6606e..59b8c48 100644
--- a/poc/iso_values.sage
+++ b/poc/iso_values.sage
@@ -20,6 +20,7 @@ def show_elm(val):
def show_iso(iso):
(xm, ym) = iso.rational_maps()
+ print(xm)
maps = (xm.numerator(), xm.denominator(), ym.numerator(), ym.denominator())
strs = ("x\\_num", "x\\_den", "y\\_num", "y\\_den")
mstr = ""
@@ -66,10 +67,29 @@ def iso_secp256k1():
A = 0
B = 7
E = EllipticCurve(GF(p), [A, B])
+
+ G = E(0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798, 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8)
+ print("generator")
+ print(G)
+
Ap = 0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533
Bp = 1771
Ep = EllipticCurve(GF(p), [Ap, Bp])
- iso = EllipticCurveIsogeny(E=E, kernel=None, codomain=Ep, degree=3).dual()
+
+ iso_straight = EllipticCurveIsogeny(E=E, kernel=None, codomain=Ep, degree=3)
+ print("isogenous generator")
+ # Gp = iso_straight(G)
+ Gp = Ep(75295888890003590383366995344834012177557063699577440394299653383124903397514, 82553647407850972504999846303729620951309077682374043495922869307182479212755)
+ print(Gp)
+
+ iso = iso_straight.dual()
+ print("does it looks good?")
+ # print(iso(Gp) - 2*G == G)
+ print(iso(Gp) == G)
+
+ # print(".division_points(3)")
+ # print(Gp.division_points(3))
+
if (- iso.rational_maps()[1])(1, 1) > iso.rational_maps()[1](1, 1):
iso.switch_sign()
_iso_secp256k1 = iso
评论 (0)