123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122(**
https://neuromancer.sk/std/bn/bn254
https://tools.ietf.org/id/draft-yonezawa-pairing-friendly-curves-00.html
Base field: 16798108731015832284940804142231733909889187121439069848933715426072753864723 (254 bits - 32 bytes)
Scalar field: 16798108731015832284940804142231733909759579603404752749028378864165570215949 (254 bits - 32 bytes)
Base field multiplicative subgroup decomposition:
TODO
Prime field multiplication subgroup decomposition:
TODO
*)moduleFq=Ff.MakeFp(structletprime_order=Z.of_string"0x2523648240000001BA344D80000000086121000000000013A700000000000013"end)moduleFp=Ff.MakeFp(structletprime_order=Z.of_string"0x2523648240000001BA344D8000000007FF9F800000000010A10000000000000D"end)moduleProjective=Ec.MakeProjectiveWeierstrass(Fq)(Fp)(structleta=Fq.zeroletb=Fq.of_z(Z.of_int2)letcofactor=Z.one(* x = 0x2523648240000001BA344D80000000086121000000000013A700000000000012
y = 0x0000000000000000000000000000000000000000000000000000000000000001
*)letbytes_generator=Bytes.concatBytes.empty[Fq.(to_bytes(of_string"0x2523648240000001BA344D80000000086121000000000013A700000000000012"));Fq.(to_bytes(of_string"1"));Fq.(to_bytesone);]end)moduleJacobian=Ec.MakeJacobianWeierstrass(Fq)(Fp)(structleta=Fq.zeroletb=Fq.of_z(Z.of_int2)letcofactor=Z.one(* x = 0x2523648240000001BA344D80000000086121000000000013A700000000000012
y = 0x0000000000000000000000000000000000000000000000000000000000000001
*)letbytes_generator=Bytes.concatBytes.empty[Fq.(to_bytes(of_string"0x2523648240000001BA344D80000000086121000000000013A700000000000012"));Fq.(to_bytes(of_string"1"));Fq.(to_bytesone);]end)moduleAffine=Ec.MakeAffineWeierstrass(Fq)(Fp)(structleta=Fq.zeroletb=Fq.of_z(Z.of_int2)letcofactor=Z.one(* x = 0x2523648240000001BA344D80000000086121000000000013A700000000000012
y = 0x0000000000000000000000000000000000000000000000000000000000000001
*)letbytes_generator=Bytes.concatBytes.empty[Fq.(to_bytes(of_string"0x2523648240000001BA344D80000000086121000000000013A700000000000012"));Fq.(to_bytes(of_string"1"));]end)letfrom_affine_weierstrass_to_jacobian_weierstrassp=Ec.from_affine_weierstrass_to_jacobian_weierstrass(moduleAffine)(moduleJacobian)pletfrom_affine_weierstrass_to_projective_weierstrassp=Ec.from_affine_weierstrass_to_projective_weierstrass(moduleAffine)(moduleProjective)pletfrom_jacobian_weierstrass_to_affine_weierstrassp=Ec.from_jacobian_weierstrass_to_affine_weierstrass(moduleJacobian)(moduleAffine)pletfrom_projective_weierstrass_to_affine_weierstrassp=Ec.from_projective_weierstrass_to_affine_weierstrass(moduleProjective)(moduleAffine)p