Skip to content

bcc-research/CryptoUtilities.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CryptoUtilities.jl

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.

Features

  • 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.

Installation

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.

Usage

Notebooks

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.

Binary Fields

using BinaryFields

a = BinaryElem16(0x1)
b = BinaryElem16(0x2)
c = a * b
println(c)

Reed-Solomon Encoding

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))

Merkle Trees

using BatchedMerkleTree

leaves = [rand(UInt16, 4) for _ in 1:16]
tree = build_merkle_tree(leaves)
root = get_root(tree)
println("Root hash: ", bytes2hex(root))

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages