Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking PR for v0.8.0 release #194

Merged
merged 73 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
4cf8eeb
chore: update crate version to v0.8
bobbinth Oct 12, 2023
f44175e
config: add .editorconfig
hackaugusto Oct 19, 2023
8300094
chore: update main readme
bobbinth Oct 19, 2023
2bbea37
rpo: added conversions for digest
hackaugusto Oct 26, 2023
9679329
feat: RPX (xHash12) hash function implementation
Al-Kindi-0 Oct 24, 2023
b4e2d63
docs: added RPX benchmarks
Al-Kindi-0 Oct 26, 2023
bfae06e
docs: update changelog
bobbinth Oct 26, 2023
97ee929
mmr: publicly export MmrDelta
hackaugusto Oct 27, 2023
9239340
mmr: support arbitrary from/to delta updates
hackaugusto Oct 27, 2023
c726050
mmr: support proofs with older forest versions
hackaugusto Oct 27, 2023
4144f98
docs: update bench readme
bobbinth Oct 27, 2023
ecb8719
chore: bump winterfell release to .7
Al-Kindi-0 Oct 24, 2023
8083b02
chore: update changelog
bobbinth Oct 29, 2023
672340d
mmr: support accumulator of older forest versions
hackaugusto Nov 1, 2023
2656060
simple_smt: reduce serialized size, use static hashes of the empty word
hackaugusto Nov 2, 2023
800994c
mmr: add into_parts for the peaks
hackaugusto Nov 2, 2023
2499a8a
Consuming iterator for RpoDigest
plafer Nov 7, 2023
7ec7b06
feat: memoize Signature polynomial decoding
austinabell Nov 9, 2023
894e20f
simplesmt: bugfix, index must be validated before modifying the tree
hackaugusto Nov 22, 2023
9e77a7c
Introduce `SimpleSmt::with_contiguous_leaves()` (#227)
plafer Nov 27, 2023
223fbf8
simplesmt: simplify duplicate check
hackaugusto Nov 22, 2023
81a94ec
Remove `ExactSizeIterator` constraint from `SimpleSmt::with_leaves()`…
plafer Nov 28, 2023
29e0d07
MmrPeaks::hash_peaks() returns Digest (#230)
plafer Nov 28, 2023
e5f3b28
bugfix: TSMT failed to verify empty word for depth 64.
hackaugusto Nov 2, 2023
8bb080a
Implement `SimpleSmt::set_subtree` (#232)
plafer Dec 5, 2023
4758e06
serde: for MerklePath, ValuePath, and RootPath
hackaugusto Dec 4, 2023
af76cb1
feat: move RpoRandomCoin and define Rng trait
Al-Kindi-0 Dec 18, 2023
9d854f1
feat: add serialization to RpoRandomCoin
bobbinth Dec 19, 2023
600feaf
feat: implement inner_nodes() iterator for PartialMmr
bobbinth Dec 19, 2023
499f970
fix: typos
bobbinth Dec 21, 2023
0296e05
refactor: return MmrPeaks from PartialMmr::peaks()
bobbinth Dec 21, 2023
9fb4133
feat: add Clone derive to PartialMmr
bobbinth Dec 21, 2023
5142e2f
chore: export default Winterfell randomcoin
Al-Kindi-0 Dec 21, 2023
2ef6f79
Merge pull request #241 from 0xPolygonMiden/al-export-default-randcoin
bobbinth Dec 21, 2023
4aac008
fix: bugfix in PartialMmr apply delta
bobbinth Dec 24, 2023
290894f
Merge pull request #242 from 0xPolygonMiden/bobbin-partial-mmr-apply
bobbinth Dec 24, 2023
88bcdfd
feat: use AVX2 instructions whenever available
gswirski Dec 8, 2023
862ccf5
Merge pull request #234 from reilabs/avx
bobbinth Jan 4, 2024
e41f88b
docs: update changelog and readme
bobbinth Jan 6, 2024
fa5b06d
chore: update CI jobs
bobbinth Jan 6, 2024
7ac5369
chore: update CI.yaml
bobbinth Jan 6, 2024
8e4350e
refactor: remove sve feature flag
bobbinth Jan 6, 2024
7ea36b7
Merge pull request #244 from 0xPolygonMiden/bobbin-sve
bobbinth Jan 6, 2024
81f521f
feat: add PartialMmr::is_tracked()
bobbinth Jan 13, 2024
5e54af4
fix: clippy
bobbinth Jan 13, 2024
e40cc95
Fix: typos (#249)
cristiantroy Jan 17, 2024
175142a
New padding rule for RPX (#236)
Al-Kindi-0 Jan 17, 2024
999db5b
feat: add to_hex() to RpoDigest and RpxDigest
bobbinth Jan 18, 2024
ff0afd3
docs: fix warnings
hackaugusto Jan 18, 2024
bd6b2a4
ci: verify docs syntax
hackaugusto Jan 18, 2024
0819bf5
Merge pull request #256 from 0xPolygonMiden/hacka-fix-doc-syntax
bobbinth Jan 18, 2024
12df4c8
Introduce `SparseMerkleTree` trait (#245)
plafer Jan 18, 2024
1703c52
refactor: remove obsolete traits
bobbinth Jan 19, 2024
4fb7446
Merge pull request #257 from 0xPolygonMiden/bobbin-remove-traits
bobbinth Jan 19, 2024
89a2988
Implement `Smt` struct (replacement to `TieredSmt`) (#254)
plafer Jan 19, 2024
34eb6b4
partialmmr: Method add with support for a single peak and tracking
hackaugusto Jan 23, 2024
19bc7ce
Merge pull request #263 from 0xPolygonMiden/hacka-issue-258
hackaugusto Jan 25, 2024
a4b82bb
fix(dsa): fix deserialization logic (#266)
birchmd Jan 26, 2024
9ab18e2
fix: always pad bytes with 10*0 (#267)
Al-Kindi-0 Jan 27, 2024
06fc9e9
docs: minor padding comment update
bobbinth Jan 27, 2024
c7b40eb
feat: add Debug and Clone derives for Falcon signature
bobbinth Jan 29, 2024
4dc975e
Add methods to `Smt` necessary for VM tests (#264)
plafer Jan 29, 2024
1108a94
feat: add PartialMmr::from_parts() constructor
bobbinth Jan 30, 2024
69fd415
Add missing methods to `Smt` (#268)
plafer Jan 30, 2024
73f702f
`Smt`: remove inner nodes when removing value (#269)
plafer Feb 4, 2024
a80e2b1
fix: peak index calculation in MmrProof
bobbinth Feb 5, 2024
1f6c479
Introduce `SmtProof` (#270)
plafer Feb 6, 2024
5a55e29
reexport (#273)
plafer Feb 6, 2024
70e6a4c
Clone (#274)
plafer Feb 6, 2024
120cafa
`SmtProof`: add accessors (#276)
plafer Feb 7, 2024
3a22091
Remove `TieredSmt` (#277)
plafer Feb 8, 2024
29c12b6
refactor: update repo to be compatible with Winterfell 0.8 (#275)
Fumuran Feb 14, 2024
25dedae
chore: update changelog
bobbinth Feb 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Documentation available at editorconfig.org

root=true

[*]
ident_style = space
ident_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.rs]
max_line_length = 100

[*.md]
trim_trailing_whitespace = false

[*.yml]
ident_size = 2
106 changes: 69 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,74 @@ on:
branches:
- main
pull_request:
types: [opened, repoened, synchronize]
types: [opened, reopened, synchronize]

jobs:
build:
name: Build ${{matrix.toolchain}} on ${{matrix.os}} with ${{matrix.args}}
rustfmt:
name: rustfmt ${{matrix.toolchain}} on ${{matrix.os}}
runs-on: ${{matrix.os}}-latest
strategy:
fail-fast: false
matrix:
toolchain: [stable, nightly]
toolchain: [nightly]
os: [ubuntu]
steps:
- uses: actions/checkout@v4
- name: Install minimal Rust with rustfmt
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{matrix.toolchain}}
components: rustfmt
override: true
- name: fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

clippy:
name: clippy ${{matrix.toolchain}} on ${{matrix.os}}
runs-on: ${{matrix.os}}-latest
strategy:
fail-fast: false
matrix:
toolchain: [nightly]
os: [ubuntu]
target: [wasm32-unknown-unknown]
args: [--no-default-features --target wasm32-unknown-unknown]
steps:
- uses: actions/checkout@main
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install rust
- name: Install minimal Rust with clippy
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{matrix.toolchain}}
components: clippy
override: true
- run: rustup target add ${{matrix.target}}
- name: Test
- name: Clippy
uses: actions-rs/cargo@v1
with:
command: build
args: ${{matrix.args}}
command: clippy
args: --all-targets -- -D clippy::all -D warnings
- name: Clippy all features
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features -- -D clippy::all -D warnings

test:
name: Test ${{matrix.toolchain}} on ${{matrix.os}} with ${{matrix.features}}
name: test ${{matrix.toolchain}} on ${{matrix.os}} with ${{matrix.features}}
runs-on: ${{matrix.os}}-latest
strategy:
fail-fast: false
matrix:
toolchain: [stable, nightly]
os: [ubuntu]
features: ["--features default,std,serde", --no-default-features]
features: ["--features default,serde", --no-default-features]
timeout-minutes: 30
steps:
- uses: actions/checkout@main
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install rust
Expand All @@ -57,45 +85,49 @@ jobs:
command: test
args: ${{matrix.features}}

clippy:
name: Clippy with ${{matrix.features}}
no-std:
name: build ${{matrix.toolchain}} no-std for wasm32-unknown-unknown
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features: ["--features default,std,serde", --no-default-features]
toolchain: [stable, nightly]
steps:
- uses: actions/checkout@main
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install minimal nightly with clippy
- name: Install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: clippy
toolchain: ${{matrix.toolchain}}
override: true
- name: Clippy
- run: rustup target add wasm32-unknown-unknown
- name: Build
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all ${{matrix.features}} -- -D clippy::all -D warnings
command: build
args: --no-default-features --target wasm32-unknown-unknown

rustfmt:
name: rustfmt
docs:
name: Verify the docs on ${{matrix.toolchain}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain: [stable]
steps:
- uses: actions/checkout@main
- name: Install minimal stable with rustfmt
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
toolchain: ${{matrix.toolchain}}
override: true

- name: rustfmt
- name: Check docs
uses: actions-rs/cargo@v1
env:
RUSTDOCFLAGS: -D warnings
with:
command: fmt
args: --all -- --check
command: doc
args: --verbose --all-features --keep-going
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ Cargo.lock

# Generated by cmake
cmake-build-*

# VS Code
.vscode/
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 0.8.0 (2024-02-14)

* Implemented the `PartialMmr` data structure (#195).
* Implemented RPX hash function (#201).
* Added `FeltRng` and `RpoRandomCoin` (#237).
* Accelerated RPO/RPX hash functions using AVX512 instructions (#234).
* Added `inner_nodes()` method to `PartialMmr` (#238).
* Improved `PartialMmr::apply_delta()` (#242).
* Refactored `SimpleSmt` struct (#245).
* Replaced `TieredSmt` struct with `Smt` struct (#254, #277).
* Updated Winterfell dependency to v0.8 (#275).

## 0.7.1 (2023-10-10)

* Fixed RPO Falcon signature build on Windows.
Expand All @@ -12,7 +24,6 @@
* Implemented benchmarking for `TieredSmt` (#182).
* Added more leaf traversal methods for `MerkleStore` (#185).
* Added SVE acceleration for RPO hash function (#189).
* Implemented the `PartialMmr` datastructure (#195).

## 0.6.0 (2023-06-25)

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ For example, a new change to the AIR crate might have the following message: `fe
// ================================================================================
```
- [Rustfmt](https://github.com/rust-lang/rustfmt) and [Clippy](https://github.com/rust-lang/rust-clippy) linting is included in CI pipeline. Anyways it's prefferable to run linting locally before push:
- [Rustfmt](https://github.com/rust-lang/rustfmt) and [Clippy](https://github.com/rust-lang/rust-clippy) linting is included in CI pipeline. Anyways it's preferable to run linting locally before push:
```
cargo fix --allow-staged --allow-dirty --all-targets --all-features; cargo fmt; cargo clippy --workspace --all-targets --all-features -- -D warnings
```
Expand Down
35 changes: 21 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[package]
name = "miden-crypto"
version = "0.7.1"
version = "0.8.0"
description = "Miden Cryptographic primitives"
authors = ["miden contributors"]
readme = "README.md"
license = "MIT"
repository = "https://github.com/0xPolygonMiden/crypto"
documentation = "https://docs.rs/miden-crypto/0.7.1"
documentation = "https://docs.rs/miden-crypto/0.8.0"
categories = ["cryptography", "no-std"]
keywords = ["miden", "crypto", "hash", "merkle"]
edition = "2021"
rust-version = "1.73"
rust-version = "1.75"

[[bin]]
name = "miden-crypto"
Expand All @@ -35,23 +35,30 @@ harness = false
default = ["std"]
executable = ["dep:clap", "dep:rand_utils", "std"]
serde = ["dep:serde", "serde?/alloc", "winter_math/serde"]
std = ["blake3/std", "dep:cc", "dep:libc", "winter_crypto/std", "winter_math/std", "winter_utils/std"]
sve = ["std"]
std = [
"blake3/std",
"dep:cc",
"dep:libc",
"winter_crypto/std",
"winter_math/std",
"winter_utils/std",
]

[dependencies]
blake3 = { version = "1.5", default-features = false }
clap = { version = "4.4", features = ["derive"], optional = true }
libc = { version = "0.2", default-features = false, optional = true }
rand_utils = { version = "0.6", package = "winter-rand-utils", optional = true }
serde = { version = "1.0", features = [ "derive" ], default-features = false, optional = true }
winter_crypto = { version = "0.6", package = "winter-crypto", default-features = false }
winter_math = { version = "0.6", package = "winter-math", default-features = false }
winter_utils = { version = "0.6", package = "winter-utils", default-features = false }
clap = { version = "4.5", features = ["derive"], optional = true }
libc = { version = "0.2", default-features = false, optional = true }
rand_utils = { version = "0.8", package = "winter-rand-utils", optional = true }
serde = { version = "1.0", features = ["derive"], default-features = false, optional = true }
winter_crypto = { version = "0.8", package = "winter-crypto", default-features = false }
winter_math = { version = "0.8", package = "winter-math", default-features = false }
winter_utils = { version = "0.8", package = "winter-utils", default-features = false }

[dev-dependencies]
seq-macro = { version = "0.3" }
criterion = { version = "0.5", features = ["html_reports"] }
proptest = "1.3"
rand_utils = { version = "0.6", package = "winter-rand-utils" }
proptest = "1.4"
rand_utils = { version = "0.8", package = "winter-rand-utils" }

[build-dependencies]
cc = { version = "1.0", features = ["parallel"], optional = true }
Expand Down
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This crate contains cryptographic primitives used in Polygon Miden.

* [BLAKE3](https://github.com/BLAKE3-team/BLAKE3) hash function with 256-bit, 192-bit, or 160-bit output. The 192-bit and 160-bit outputs are obtained by truncating the 256-bit output of the standard BLAKE3.
* [RPO](https://eprint.iacr.org/2022/1577) hash function with 256-bit output. This hash function is an algebraic hash function suitable for recursive STARKs.
* [RPX](https://eprint.iacr.org/2023/1045) hash function with 256-bit output. Similar to RPO, this hash function is suitable for recursive STARKs but it is about 2x faster as compared to RPO.

For performance benchmarks of these hash functions and their comparison to other popular hash functions please see [here](./benches/).

Expand All @@ -16,18 +17,25 @@ For performance benchmarks of these hash functions and their comparison to other
* `MerkleTree`: a regular fully-balanced binary Merkle tree. The depth of this tree can be at most 64.
* `Mmr`: a Merkle mountain range structure designed to function as an append-only log.
* `PartialMerkleTree`: a partial view of a Merkle tree where some sub-trees may not be known. This is similar to a collection of Merkle paths all resolving to the same root. The length of the paths can be at most 64.
* `PartialMmr`: a partial view of a Merkle mountain range structure.
* `SimpleSmt`: a Sparse Merkle Tree (with no compaction), mapping 64-bit keys to 4-element values.
* `TieredSmt`: a Sparse Merkle tree (with compaction), mapping 4-element keys to 4-element values.
* `Smt`: a Sparse Merkle tree (with compaction at depth 64), mapping 4-element keys to 4-element values.

The module also contains additional supporting components such as `NodeIndex`, `MerklePath`, and `MerkleError` to assist with tree indexation, opening proofs, and reporting inconsistent arguments/state.

## Signatures
[DAS module](./src/dsa) provides a set of digital signature schemes supported by default in the Miden VM. Currently, these schemes are:
[DSA module](./src/dsa) provides a set of digital signature schemes supported by default in the Miden VM. Currently, these schemes are:

* `RPO Falcon512`: a variant of the [Falcon](https://falcon-sign.info/) signature scheme. This variant differs from the standard in that instead of using SHAKE256 hash function in the *hash-to-point* algorithm we use RPO256. This makes the signature more efficient to verify in Miden VM.

For the above signatures, key generation and signing is available only in the `std` context (see [crate features](#crate-features) below), while signature verification is available in `no_std` context as well.

## Pseudo-Random Element Generator
[Pseudo random element generator module](./src/rand/) provides a set of traits and data structures that facilitate generating pseudo-random elements in the context of Miden VM and Miden rollup. The module currently includes:

* `FeltRng`: a trait for generating random field elements and random 4 field elements.
* `RpoRandomCoin`: a struct implementing `FeltRng` as well as the [`RandomCoin`](https://github.com/facebook/winterfell/blob/main/crypto/src/random/mod.rs) trait.

## Crate features
This crate can be compiled with the following features:

Expand All @@ -38,10 +46,16 @@ Both of these features imply the use of [alloc](https://doc.rust-lang.org/alloc/

To compile with `no_std`, disable default features via `--no-default-features` flag.

### AVX2 acceleration
On platforms with [AVX2](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions) support, RPO and RPX hash function can be accelerated by using the vector processing unit. To enable AVX2 acceleration, the code needs to be compiled with the `avx2` target feature enabled. For example:
```shell
RUSTFLAGS="-C target-feature=+avx2" cargo build --release
```

### SVE acceleration
On platforms with [SVE](https://en.wikipedia.org/wiki/AArch64#Scalable_Vector_Extension_(SVE)) support, RPO hash function can be accelerated by using the vector processing unit. To enable SVE acceleration, the code needs to be compiled with the `sve` feature enabled. This feature has an effect only if the platform exposes `target-feature=sve` flag. On some platforms (e.g., Graviton 3), for this flag to be set, the compilation must be done in "native" mode. For example, to enable SVE acceleration on Graviton 3, we can execute the following:
On platforms with [SVE](https://en.wikipedia.org/wiki/AArch64#Scalable_Vector_Extension_(SVE)) support, RPO and RPX hash function can be accelerated by using the vector processing unit. To enable SVE acceleration, the code needs to be compiled with the `sve` target feature enabled. For example:
```shell
RUSTFLAGS="-C target-cpu=native" cargo build --release --features sve
RUSTFLAGS="-C target-feature=+sve" cargo build --release
```

## Testing
Expand Down
38 changes: 21 additions & 17 deletions benches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ In the Miden VM, we make use of different hash functions. Some of these are "tra
* **Poseidon** as specified [here](https://eprint.iacr.org/2019/458.pdf) and implemented [here](https://github.com/mir-protocol/plonky2/blob/806b88d7d6e69a30dc0b4775f7ba275c45e8b63b/plonky2/src/hash/poseidon_goldilocks.rs) (but in pure Rust, without vectorized instructions).
* **Rescue Prime (RP)** as specified [here](https://eprint.iacr.org/2020/1143) and implemented [here](https://github.com/novifinancial/winterfell/blob/46dce1adf0/crypto/src/hash/rescue/rp64_256/mod.rs).
* **Rescue Prime Optimized (RPO)** as specified [here](https://eprint.iacr.org/2022/1577) and implemented in this crate.
* **Rescue Prime Extended (RPX)** a variant of the [xHash](https://eprint.iacr.org/2023/1045) hash function as implemented in this crate.

## Comparison and Instructions

Expand All @@ -15,28 +16,31 @@ The second scenario is that of sequential hashing where we take a sequence of le

#### Scenario 1: 2-to-1 hashing `h(a,b)`

| Function | BLAKE3 | SHA3 | Poseidon | Rp64_256 | RPO_256 |
| ------------------- | ------ | --------| --------- | --------- | ------- |
| Apple M1 Pro | 80 ns | 245 ns | 1.5 us | 9.1 us | 5.4 us |
| Apple M2 | 76 ns | 233 ns | 1.3 us | 7.9 us | 5.0 us |
| Amazon Graviton 3 | 108 ns | | | | 5.3 us |
| AMD Ryzen 9 5950X | 64 ns | 273 ns | 1.2 us | 9.1 us | 5.5 us |
| Intel Core i5-8279U | 80 ns | | | | 8.7 us |
| Intel Xeon 8375C | 67 ns | | | | 8.2 us |
| Function | BLAKE3 | SHA3 | Poseidon | Rp64_256 | RPO_256 | RPX_256 |
| ------------------- | ------ | ------- | --------- | --------- | ------- | ------- |
| Apple M1 Pro | 76 ns | 245 ns | 1.5 µs | 9.1 µs | 5.2 µs | 2.7 µs |
| Apple M2 Max | 71 ns | 233 ns | 1.3 µs | 7.9 µs | 4.6 µs | 2.4 µs |
| Amazon Graviton 3 | 108 ns | | | | 5.3 µs | 3.1 µs |
| AMD Ryzen 9 5950X | 64 ns | 273 ns | 1.2 µs | 9.1 µs | 5.5 µs | |
| AMD EPYC 9R14 | 83 ns | | | | 4.3 µs | 2.4 µs |
| Intel Core i5-8279U | 68 ns | 536 ns | 2.0 µs | 13.6 µs | 8.5 µs | 4.4 µs |
| Intel Xeon 8375C | 67 ns | | | | 8.2 µs | |

#### Scenario 2: Sequential hashing of 100 elements `h([a_0,...,a_99])`

| Function | BLAKE3 | SHA3 | Poseidon | Rp64_256 | RPO_256 |
| ------------------- | -------| ------- | --------- | --------- | ------- |
| Apple M1 Pro | 1.0 us | 1.5 us | 19.4 us | 118 us | 70 us |
| Apple M2 | 1.0 us | 1.5 us | 17.4 us | 103 us | 65 us |
| Amazon Graviton 3 | 1.4 us | | | | 69 us |
| AMD Ryzen 9 5950X | 0.8 us | 1.7 us | 15.7 us | 120 us | 72 us |
| Intel Core i5-8279U | 1.0 us | | | | 116 us |
| Intel Xeon 8375C | 0.8 ns | | | | 110 us |
| Function | BLAKE3 | SHA3 | Poseidon | Rp64_256 | RPO_256 | RPX_256 |
| ------------------- | -------| ------- | --------- | --------- | ------- | ------- |
| Apple M1 Pro | 1.0 µs | 1.5 µs | 19.4 µs | 118 µs | 69 µs | 35 µs |
| Apple M2 Max | 0.9 µs | 1.5 µs | 17.4 µs | 103 µs | 60 µs | 31 µs |
| Amazon Graviton 3 | 1.4 µs | | | | 69 µs | 41 µs |
| AMD Ryzen 9 5950X | 0.8 µs | 1.7 µs | 15.7 µs | 120 µs | 72 µs | |
| AMD EPYC 9R14 | 0.9 µs | | | | 56 µs | 32 µs |
| Intel Core i5-8279U | 0.9 µs | | | | 107 µs | 56 µs |
| Intel Xeon 8375C | 0.8 µs | | | | 110 µs | |

Notes:
- On Graviton 3, RPO256 is run with SVE acceleration enabled.
- On Graviton 3, RPO256 and RPX256 are run with SVE acceleration enabled.
- On AMD EPYC 9R14, RPO256 and RPX256 are run with AVX2 acceleration enabled.

### Instructions
Before you can run the benchmarks, you'll need to make sure you have Rust [installed](https://www.rust-lang.org/tools/install). After that, to run the benchmarks for RPO and BLAKE3, clone the current repository, and from the root directory of the repo run the following:
Expand Down
Loading
Loading