packageff-bench
Install
Dune Dependency
Authors
Maintainers
Sources
md5=fa68c430de8cba04fb8b7819e4cc4b38
sha512=2046126f30704c16bd2dcd735b7eb9b8a6c8751892f895e6c992b0ebb921f7d2c824b9507b74368e3b66b53330dc70a57e70633105b642d021710b34fbc54a5c
Description
Published:10 Jun 2021
README
OCaml FF
Play with Finite Field in OCaml
This library provides functors to instantiate finite field of arbitrary orders (in the limit of Zarith, the dependency to handle arbitrary integers).
module F13 = Ff.MakeFp (struct let prime_order = Z.of_string "13" end)module BLSFr = Ff.MakeFp ( struct let prime_order = Z.of_string "52435875175126190479447740508185965837690552500527637822603658699938581184513" end)
JavaScript compatibility
This library can be transpiled in JavaScript using js_of_ocaml. An example is provided injs/test_js.ml
, with the correspondingdune
file. It instantiates Fp with p = 53.dune
will compile this into aFiniteField.js
file, exporting methods likeadd
,toString
,random
, etc.FiniteField
can be used as a Node module. Seejs/test/test_js.js
for an example.
# Generate FiniteField.jsdune build jscp _build/default/js/FiniteField.js ./node
var FF = require("./FiniteField.js");let x = FF.random();let y = FF.random();let x_plus_y = FF.add(x, y);
Install
opam install ff
For a specific version (from 0.2.1), use
opam install ff.0.3.0
Replace 0.3.0 with the version you want, seetags.
Documentation
Seehere
PBT testing
A packageff-pbt
is also included and published providing Property Based Testing of finite fields based on the generic finite fields interface given inff
. If you have a library implementing finite fields, but not using the functors provided byff
, you can use:
(* You module is MyField *)module MyFieldProperties = Ff_pbt.MakeFieldProperties (MyField)let () = let open Alcotest in run "MyField" [MyFieldProperties.get_tests()]
It is stronly relying on therandom
function implemented by the finite field module.
Benchmark
ff-bench
is a benchmark library (usingCore_bench
) for finite fields, respecting the signatureFf_sig.BASE
. Here how to use:
module F337 = Ff.Make (struct let prime_order = Z.of_string "337" end)module Bench = Ff_bench.MakeBench (F337)let () = let commands = Bench.get_benches "F337" in Core.Command.run (Core.Bench.make_command commands)
Dependencies (5)
- core_bench
>= "v0.13.0"
- core
>= "v0.13.0"
- ff-sig
= version
- dune
>= "2.7"
- ocaml
>= "4.08"
Dev Dependencies
None
Used by
None
Conflicts
None