package ff

  1. Overview
  2. Docs
OCaml implementation of Finite Field operations

Install

Dune Dependency

Authors

Maintainers

Sources

ocaml-ff-0.2.2.tar.gz
md5=15531761e4710f908b35bd3b1c7170f5
sha512=6d1e9fc60dc15953951861e4eaf5b87bef3623b16deb120b705289dd3df7e915975632bb0c7212353722cc02361c3ac109e28372539177ce548c6a15c7fef0f0

Description

OCaml implementation of Finite Field operations

Published: 19 Aug 2020

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 in js/test_js.ml, with the corresponding dune file. It instantiates Fp with p = 53. dune will compile this into a FiniteField.js file, exporting methods like add, toString, random, etc. FiniteField can be used as a Node module. See js/test/test_js.js for an example.

# Generate FiniteField.js
dune build js
cp _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);

Dependencies (2)

  1. zarith >= "1.9.1" & < "2.0"
  2. dune >= "2.0"

Dev Dependencies (1)

  1. alcotest with-test

Used by (1)

  1. tezos-plompiler < "1.0.0"

Conflicts

None

OCaml

Innovation. Community. Security.