aboutsummaryrefslogtreecommitdiff
path: root/lib/curves.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/curves.ml')
-rw-r--r--lib/curves.ml146
1 files changed, 0 insertions, 146 deletions
diff --git a/lib/curves.ml b/lib/curves.ml
deleted file mode 100644
index 1182352..0000000
--- a/lib/curves.ml
+++ /dev/null
@@ -1,146 +0,0 @@
-module E = Curve.Make (struct
- module F = Fields.Fp
-
- let b = F.of_string "4"
-
- let g =
- F.
- ( of_string
- "3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507",
- of_string
- "1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569"
- )
-
- let n =
- Z.of_string
- "52435875175126190479447740508185965837690552500527637822603658699938581184513"
-end)
-
-module E2 = Curve.Make (struct
- module F = Fields.Fp2
-
- let b = F.of_string "(4,4)"
-
- let g =
- F.
- ( of_coeffs
- Fields.Fp.
- [|
- of_string
- "352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160";
- of_string
- "3059144344244213709971259814753781636986470325476647558659373206291635324768958432433509563104347017837885763365758";
- |],
- of_coeffs
- Fields.Fp.
- [|
- of_string
- "1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905";
- of_string
- "927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582";
- |] )
-
- let n = E.n
-end)
-
-module E12 = Curve.Make (struct
- module F = Fields.Fp12
-
- let b = F.of_f @@ Fields.Fp.of_string "4"
-
- let g =
- F.
- ( of_coeffs
- Fields.Fp.
- [|
- zero;
- zero;
- zero;
- zero;
- of_string
- "352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160";
- zero;
- zero;
- zero;
- zero;
- zero;
- of_string
- "1353221637328373545892060349371360746048220186341936159219732281025920769516621702780080981380240920942561918531299";
- zero;
- |],
- of_coeffs
- Fields.Fp.
- [|
- zero;
- zero;
- zero;
- of_string
- "1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905";
- zero;
- zero;
- zero;
- zero;
- zero;
- of_string
- "1472406309213353956798468635167385199506877017588472562248853724925831900559844855499883907296819622485916638215732";
- zero;
- zero;
- |] )
-
- let n = E.n
-end)
-
-let twist =
- let ws =
- lazy
- (let w =
- Fields.Fp12.of_coeffs
- Fields.Fp.
- [|
- zero;
- one;
- zero;
- zero;
- zero;
- zero;
- zero;
- zero;
- zero;
- zero;
- zero;
- zero;
- |]
- in
- let w2 = Fields.Fp12.(w * w) in
- let w3 = Fields.Fp12.(w2 * w) in
- let w2inv = Fields.Fp12.inv w2 in
- let w3inv = Fields.Fp12.inv w3 in
- (w2inv, w3inv))
- in
- let iso a =
- let c = Fields.Fp2.to_coeffs a in
- Fields.Fp12.of_coeffs
- Fields.Fp.
- [|
- Fields.Fp.(c.(0) - c.(1));
- zero;
- zero;
- zero;
- zero;
- zero;
- c.(1);
- zero;
- zero;
- zero;
- zero;
- zero;
- |]
- in
- fun p ->
- match E2.to_coords p with
- | None -> E12.inf
- | Some (x, y) ->
- let nx, ny = (iso x, iso y) in
- let w2inv, w3inv = Lazy.force ws in
- let c = Fields.Fp12.(nx * w2inv, ny * w3inv) in
- E12.Unsafe.of_coords_unchecked c