{"id":16717725,"url":"https://github.com/dannywillems/ocaml-bls12-381","last_synced_at":"2025-10-31T14:30:35.585Z","repository":{"id":41086331,"uuid":"292339349","full_name":"dannywillems/ocaml-bls12-381","owner":"dannywillems","description":"Fast BLS12-381 implementation in OCaml","archived":false,"fork":false,"pushed_at":"2023-07-19T09:53:00.000Z","size":7751,"stargazers_count":1,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T01:51:09.046Z","etag":null,"topics":["bls-signature","bls12-381","blst","cryptography","fft","hash-to-curve","ocaml","pairing","pairing-cryptography","poseidon","rescue","signatures","tezos","zero-knowledge"],"latest_commit_sha":null,"homepage":"https://dannywillems.gitlab.io/ocaml-bls12-381/","language":"Assembly","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dannywillems.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-02T16:44:09.000Z","updated_at":"2022-06-13T12:37:06.000Z","dependencies_parsed_at":"2024-11-21T06:33:01.456Z","dependency_job_id":"20c6d34d-37e1-47e5-b881-e23b6f558454","html_url":"https://github.com/dannywillems/ocaml-bls12-381","commit_stats":null,"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dannywillems%2Focaml-bls12-381","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dannywillems%2Focaml-bls12-381/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dannywillems%2Focaml-bls12-381/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dannywillems%2Focaml-bls12-381/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dannywillems","download_url":"https://codeload.github.com/dannywillems/ocaml-bls12-381/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238941485,"owners_count":19556006,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bls-signature","bls12-381","blst","cryptography","fft","hash-to-curve","ocaml","pairing","pairing-cryptography","poseidon","rescue","signatures","tezos","zero-knowledge"],"created_at":"2024-10-12T21:33:15.367Z","updated_at":"2025-10-31T14:30:35.540Z","avatar_url":"https://github.com/dannywillems.png","language":"Assembly","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OCaml implementation of BLS12-381\n\nThis library provides a fast implementation of:\n- operations over the scalar field, including (i)FFT.\n- operations over the groups G1 and G2, including EC-FFT, hash_to_curve as\n  described [in this\n  specification](https://datatracker.ietf.org/doc/draft-irtf-cfrg-hash-to-curve/)\n  and the pippenger algorithm for fast multi scalar exponentiation.\n- operations over the target group of the pairing (GT), written additively.\n- pairing from G1 x G2 to GT\n\n## Encoding\n\n### Scalar\n\nThe scalar field is `Fr = GF(0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001)`, encoded on 32 bytes in little endian.\n\n### Groups\n\nFor G1, the base field is `Fq:\nGF(0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab`)\nand `E(Fq) := y^2 = x^3 + 4`. An element of the base field can be encoded on 48 bytes (using only\n381 bits, leaving 3 bits unused).\n\nFor G2, the base field is `Fq2 := Fq[Z]/(X^2 + 1)` and `E(Fq2) := y^2 = x^3 + 4\n(Z + 1)`. An element of the base field can be encoded on 2 * 48 bytes\nrepresenting each coefficient of the polynomial. 3 bits of each coefficient\nencoding are unused.\n\nThe « uncompressed » form `(x, y)` of G1 and G2 is the concatenation of the elements `x` and `y` encoded in big endian.\n\nThe « compressed » form uses the first 3 most significant (and unused) bits of\nthe coordinate `x`.\n- the first most significant bit is always set to `1` to carry the information it\nis the compressed encoding of a point.\n- the second most significant bit is set to `1` if the element is the identity of the curve.\n- the third most significant bit is the sign of `y`. It is set to `1` if `y` is\n  lexicographically larger than `-y`.\n\n## Install\n\n\n```shell\nopam install bls12-381\n```\n\nBy default, if the architecture supports ADX, `bls12-381` with be compiled using ADX\nopcodes (giving optimisations up to 20% for some arithmetic operations). If you\ndon't want to build using ADX, you can add the environment variable\n`BLST_PORTABLE` and set it to any value.\nFor instance,\n```\nBLST_PORTABLE=y opam install bls12-381\n```\nwill instruct to build bls12-381 without ADX. This might be useful if you\nbuild docker images on ADX machines but you need the image to be portable on\narchitecture not supporting ADX.\n\nIf the architecture does not support ADX, `bls12-381` will be compiled without ADX opcodes.\n\n## Run tests\n\n```\ndune runtest\n```\n\nTo get the coverage:\n```\ndune runtest --instrument-with bisect_ppx --force\nbisect-ppx-report html\n```\n\n## Run the benchmarks\n\nInstall `core_bench`:\n\n```\nopam install core_bench\n```\n\nSee files listed in the directory `benchmark` and execute it with `dune exec`. For instance:\n```\ndune exec ./benchmark/bench_fr.exe\n```\n\n## Documentation\n\n```\nopam install odoc\ndune build @doc\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdannywillems%2Focaml-bls12-381","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdannywillems%2Focaml-bls12-381","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdannywillems%2Focaml-bls12-381/lists"}