CryptoUtilities.jl
is a Julia package providing utilities for succinct proofs,
including hardware-optimized implementations of binary fields, Reed-Solomon
encodings, and Merkle trees with multiopening proofs.
- Binary Fields: Efficient arithmetic operations over binary fields.
- Reed-Solomon Encoding: Encoding and decoding using Reed-Solomon codes w/
O(n log n)
cost, implementing this paper. - Merkle Trees: Construction, proof generation, and verification for Merkle tree batched openings.
The packages in this repository are registered in the Julia package registry. To
use BinaryFields
or any of the other packages, simply add them by name:
using Pkg
Pkg.add("BinaryFields")
Replace "BinaryFields"
with "BinaryReedSolomon"
or "BatchedMerkleTree"
to install the other packages.
We provide examples and walkthroughs of the package (along with some Julia basics) as Pluto.jl notebooks in the CryptoUtilitiesNotebooks repository. We highly recommend reading those, which should be all you need to get started using this library. We also provide some (very basic) examples below, for completeness.
using BinaryFields
a = BinaryElem16(0x1)
b = BinaryElem16(0x2)
c = a * b
println(c)
using BinaryReedSolomon
using BinaryFields # for BinaryElem16 type
rs = reed_solomon(BinaryElem16, 256, 1024)
message = rand(BinaryElem16, 256)
encoded = encode(rs, message)
println("Encoded length: ", length(encoded))
using BatchedMerkleTree
leaves = [rand(UInt16, 4) for _ in 1:16]
tree = build_merkle_tree(leaves)
root = get_root(tree)
println("Root hash: ", bytes2hex(root))
This project is licensed under the MIT License. See the LICENSE file for details.