refactor: folder structure (#397)
This commit is contained in:
parent
b5c568eb12
commit
8b1593f0ba
87 changed files with 232 additions and 111 deletions
99
Cargo.toml
99
Cargo.toml
|
@ -1,97 +1,18 @@
|
||||||
[package]
|
[workspace]
|
||||||
name = "miden-crypto"
|
members = [
|
||||||
version = "0.14.0"
|
"miden-crypto"
|
||||||
description = "Miden Cryptographic primitives"
|
]
|
||||||
|
exclude = [
|
||||||
|
"miden-crypto-fuzz"
|
||||||
|
]
|
||||||
|
resolver = "3" # Use the edition 2024 dependency resolver
|
||||||
|
|
||||||
|
[workspace.package]
|
||||||
authors = ["miden contributors"]
|
authors = ["miden contributors"]
|
||||||
readme = "README.md"
|
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/0xPolygonMiden/crypto"
|
repository = "https://github.com/0xPolygonMiden/crypto"
|
||||||
documentation = "https://docs.rs/miden-crypto/0.14.0"
|
|
||||||
categories = ["cryptography", "no-std"]
|
categories = ["cryptography", "no-std"]
|
||||||
keywords = ["miden", "crypto", "hash", "merkle"]
|
keywords = ["miden", "crypto", "hash", "merkle"]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.85"
|
rust-version = "1.85"
|
||||||
|
|
||||||
[[bin]]
|
|
||||||
name = "miden-crypto"
|
|
||||||
path = "src/main.rs"
|
|
||||||
bench = false
|
|
||||||
doctest = false
|
|
||||||
required-features = ["executable"]
|
|
||||||
|
|
||||||
[[bench]]
|
|
||||||
name = "hash"
|
|
||||||
harness = false
|
|
||||||
|
|
||||||
[[bench]]
|
|
||||||
name = "smt"
|
|
||||||
harness = false
|
|
||||||
|
|
||||||
[[bench]]
|
|
||||||
name = "smt-subtree"
|
|
||||||
harness = false
|
|
||||||
required-features = ["internal"]
|
|
||||||
|
|
||||||
[[bench]]
|
|
||||||
name = "merkle"
|
|
||||||
harness = false
|
|
||||||
|
|
||||||
[[bench]]
|
|
||||||
name = "smt-with-entries"
|
|
||||||
harness = false
|
|
||||||
|
|
||||||
[[bench]]
|
|
||||||
name = "store"
|
|
||||||
harness = false
|
|
||||||
|
|
||||||
[features]
|
|
||||||
concurrent = ["dep:rayon", "hashbrown?/rayon"]
|
|
||||||
default = ["std", "concurrent"]
|
|
||||||
executable = ["dep:clap", "dep:rand-utils", "std"]
|
|
||||||
smt_hashmaps = ["dep:hashbrown"]
|
|
||||||
internal = []
|
|
||||||
serde = ["dep:serde", "serde?/alloc", "winter-math/serde"]
|
|
||||||
std = [
|
|
||||||
"blake3/std",
|
|
||||||
"dep:cc",
|
|
||||||
"rand/std",
|
|
||||||
"rand/thread_rng",
|
|
||||||
"winter-crypto/std",
|
|
||||||
"winter-math/std",
|
|
||||||
"winter-utils/std",
|
|
||||||
]
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
blake3 = { version = "1.5", default-features = false }
|
|
||||||
clap = { version = "4.5", optional = true, features = ["derive"] }
|
|
||||||
hashbrown = { version = "0.15", optional = true, features = ["serde"] }
|
|
||||||
num = { version = "0.4", default-features = false, features = ["alloc", "libm"] }
|
|
||||||
num-complex = { version = "0.4", default-features = false }
|
|
||||||
rand = { version = "0.9", default-features = false }
|
|
||||||
rand_core = { version = "0.9", default-features = false }
|
|
||||||
rand-utils = { version = "0.12", package = "winter-rand-utils", optional = true }
|
|
||||||
rayon = { version = "1.10", optional = true }
|
|
||||||
serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] }
|
|
||||||
sha3 = { version = "0.10", default-features = false }
|
|
||||||
thiserror = { version = "2.0", default-features = false }
|
|
||||||
winter-crypto = { version = "0.12", default-features = false }
|
|
||||||
winter-math = { version = "0.12", default-features = false }
|
|
||||||
winter-utils = { version = "0.12", default-features = false }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
assert_matches = { version = "1.5", default-features = false }
|
|
||||||
criterion = { version = "0.5", features = ["html_reports"] }
|
|
||||||
getrandom = { version = "0.3", default-features = false }
|
|
||||||
hex = { version = "0.4", default-features = false, features = ["alloc"] }
|
|
||||||
proptest = { version = "1.6", default-features = false, features = ["alloc"]}
|
|
||||||
rand_chacha = { version = "0.9", default-features = false }
|
|
||||||
rand-utils = { version = "0.12", package = "winter-rand-utils" }
|
|
||||||
seq-macro = { version = "0.3" }
|
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
cc = { version = "1.2", optional = true, features = ["parallel"] }
|
|
||||||
glob = "0.3"
|
|
||||||
|
|
||||||
[lints.rust]
|
|
||||||
# Suppress warnings about `cfg(fuzzing)`, which is automatically set when using `cargo-fuzz`.
|
|
||||||
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }
|
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -99,4 +99,4 @@ bench-smt-concurrent: ## Run SMT benchmarks with concurrent feature
|
||||||
|
|
||||||
.PHONY: fuzz-smt
|
.PHONY: fuzz-smt
|
||||||
fuzz-smt: ## Run fuzzing for SMT
|
fuzz-smt: ## Run fuzzing for SMT
|
||||||
cargo +nightly fuzz run smt --release -- -max_len=10485760
|
cargo +nightly fuzz run smt --release --fuzz-dir miden-crypto-fuzz -- -max_len=10485760
|
||||||
|
|
10
README.md
10
README.md
|
@ -10,17 +10,17 @@ This crate contains cryptographic primitives used in Polygon Miden.
|
||||||
|
|
||||||
## Hash
|
## Hash
|
||||||
|
|
||||||
[Hash module](./src/hash) provides a set of cryptographic hash functions which are used by the Miden VM and the Miden rollup. Currently, these functions are:
|
[Hash module](./miden-crypto/src/hash) provides a set of cryptographic hash functions which are used by the Miden VM and the Miden rollup. Currently, these functions are:
|
||||||
|
|
||||||
- [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.
|
- [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.
|
- [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.
|
- [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/).
|
For performance benchmarks of these hash functions and their comparison to other popular hash functions please see [here](./miden-crypto/benches/).
|
||||||
|
|
||||||
## Merkle
|
## Merkle
|
||||||
|
|
||||||
[Merkle module](./src/merkle/) provides a set of data structures related to Merkle trees. All these data structures are implemented using the RPO hash function described above. The data structures are:
|
[Merkle module](./miden-crypto/src/merkle/) provides a set of data structures related to Merkle trees. All these data structures are implemented using the RPO hash function described above. The data structures are:
|
||||||
|
|
||||||
- `MerkleStore`: a collection of Merkle trees of different heights designed to efficiently store trees with common subtrees. When instantiated with `RecordingMap`, a Merkle store records all accesses to the original data.
|
- `MerkleStore`: a collection of Merkle trees of different heights designed to efficiently store trees with common subtrees. When instantiated with `RecordingMap`, a Merkle store records all accesses to the original data.
|
||||||
- `MerkleTree`: a regular fully-balanced binary Merkle tree. The depth of this tree can be at most 64.
|
- `MerkleTree`: a regular fully-balanced binary Merkle tree. The depth of this tree can be at most 64.
|
||||||
|
@ -34,7 +34,7 @@ The module also contains additional supporting components such as `NodeIndex`, `
|
||||||
|
|
||||||
## Signatures
|
## Signatures
|
||||||
|
|
||||||
[DSA module](./src/dsa) provides a set of digital signature schemes supported by default in the Miden VM. Currently, these schemes are:
|
[DSA module](./miden-crypto/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.
|
- `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.
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ For the above signatures, key generation, signing, and signature verification ar
|
||||||
|
|
||||||
## Pseudo-Random Element Generator
|
## 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:
|
[Pseudo random element generator module](./miden-crypto/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.
|
- `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 using RPO hash function.
|
- `RpoRandomCoin`: a struct implementing `FeltRng` as well as the [`RandomCoin`](https://github.com/facebook/winterfell/blob/main/crypto/src/random/mod.rs) trait using RPO hash function.
|
||||||
|
|
129
fuzz/Cargo.lock → miden-crypto-fuzz/Cargo.lock
generated
129
fuzz/Cargo.lock → miden-crypto-fuzz/Cargo.lock
generated
|
@ -32,6 +32,12 @@ version = "1.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "2.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "blake3"
|
name = "blake3"
|
||||||
version = "1.6.0"
|
version = "1.6.0"
|
||||||
|
@ -167,13 +173,14 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.2.15"
|
version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
|
checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
"wasi",
|
"wasi",
|
||||||
|
"windows-targets",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -344,7 +351,7 @@ version = "0.2.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
|
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"zerocopy",
|
"zerocopy 0.7.35",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -367,20 +374,20 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand"
|
name = "rand"
|
||||||
version = "0.8.5"
|
version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
|
||||||
"rand_chacha",
|
"rand_chacha",
|
||||||
"rand_core",
|
"rand_core",
|
||||||
|
"zerocopy 0.8.23",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_chacha"
|
name = "rand_chacha"
|
||||||
version = "0.3.1"
|
version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ppv-lite86",
|
"ppv-lite86",
|
||||||
"rand_core",
|
"rand_core",
|
||||||
|
@ -388,9 +395,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_core"
|
name = "rand_core"
|
||||||
version = "0.6.4"
|
version = "0.9.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom",
|
"getrandom",
|
||||||
]
|
]
|
||||||
|
@ -502,9 +509,76 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.11.0+wasi-snapshot-preview1"
|
version = "0.13.3+wasi-0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2"
|
||||||
|
dependencies = [
|
||||||
|
"wit-bindgen-rt",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm",
|
||||||
|
"windows_aarch64_msvc",
|
||||||
|
"windows_i686_gnu",
|
||||||
|
"windows_i686_gnullvm",
|
||||||
|
"windows_i686_msvc",
|
||||||
|
"windows_x86_64_gnu",
|
||||||
|
"windows_x86_64_gnullvm",
|
||||||
|
"windows_x86_64_msvc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winter-crypto"
|
name = "winter-crypto"
|
||||||
|
@ -533,6 +607,15 @@ version = "0.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2d47518e6931955dcac73a584cacb04550b82ab2f45c72880cbbbdbe13adb63c"
|
checksum = "2d47518e6931955dcac73a584cacb04550b82ab2f45c72880cbbbdbe13adb63c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wit-bindgen-rt"
|
||||||
|
version = "0.33.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy"
|
name = "zerocopy"
|
||||||
version = "0.7.35"
|
version = "0.7.35"
|
||||||
|
@ -540,7 +623,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
|
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"zerocopy-derive",
|
"zerocopy-derive 0.7.35",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zerocopy"
|
||||||
|
version = "0.8.23"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fd97444d05a4328b90e75e503a34bad781f14e28a823ad3557f0750df1ebcbc6"
|
||||||
|
dependencies = [
|
||||||
|
"zerocopy-derive 0.8.23",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -553,3 +645,14 @@ dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zerocopy-derive"
|
||||||
|
version = "0.8.23"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6352c01d0edd5db859a63e2605f4ea3183ddbd15e2c4a9e7d32184df75e4f154"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
|
@ -9,7 +9,7 @@ cargo-fuzz = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libfuzzer-sys = "0.4"
|
libfuzzer-sys = "0.4"
|
||||||
miden-crypto = { path = "..", features = ["concurrent"] }
|
miden-crypto = { path = "../miden-crypto", features = ["concurrent"] }
|
||||||
rand = { version = "0.9", default-features = false }
|
rand = { version = "0.9", default-features = false }
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
|
@ -11,8 +11,8 @@ struct FuzzInput {
|
||||||
|
|
||||||
impl FuzzInput {
|
impl FuzzInput {
|
||||||
fn from_bytes(data: &[u8]) -> Self {
|
fn from_bytes(data: &[u8]) -> Self {
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::rng();
|
||||||
let split_percentage = rng.gen_range(20..80); // Randomly choose between 20% and 80%
|
let split_percentage = rng.random_range(20..80); // Randomly choose between 20% and 80%
|
||||||
|
|
||||||
let split_index = (data.len() * split_percentage) / 100;
|
let split_index = (data.len() * split_percentage) / 100;
|
||||||
let (construction_data, update_data) = data.split_at(split_index);
|
let (construction_data, update_data) = data.split_at(split_index);
|
97
miden-crypto/Cargo.toml
Normal file
97
miden-crypto/Cargo.toml
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
[package]
|
||||||
|
name = "miden-crypto"
|
||||||
|
version = "0.14.0"
|
||||||
|
description = "Miden Cryptographic primitives"
|
||||||
|
authors.workspace = true
|
||||||
|
readme = "README.md"
|
||||||
|
license.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
documentation = "https://docs.rs/miden-crypto/0.14.0"
|
||||||
|
categories.workspace = true
|
||||||
|
keywords.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "miden-crypto"
|
||||||
|
path = "src/main.rs"
|
||||||
|
bench = false
|
||||||
|
doctest = false
|
||||||
|
required-features = ["executable"]
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "hash"
|
||||||
|
harness = false
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "smt"
|
||||||
|
harness = false
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "smt-subtree"
|
||||||
|
harness = false
|
||||||
|
required-features = ["internal"]
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "merkle"
|
||||||
|
harness = false
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "smt-with-entries"
|
||||||
|
harness = false
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "store"
|
||||||
|
harness = false
|
||||||
|
|
||||||
|
[features]
|
||||||
|
concurrent = ["dep:rayon", "hashbrown?/rayon"]
|
||||||
|
default = ["std", "concurrent"]
|
||||||
|
executable = ["dep:clap", "dep:rand-utils", "std"]
|
||||||
|
smt_hashmaps = ["dep:hashbrown"]
|
||||||
|
internal = []
|
||||||
|
serde = ["dep:serde", "serde?/alloc", "winter-math/serde"]
|
||||||
|
std = [
|
||||||
|
"blake3/std",
|
||||||
|
"dep:cc",
|
||||||
|
"rand/std",
|
||||||
|
"rand/thread_rng",
|
||||||
|
"winter-crypto/std",
|
||||||
|
"winter-math/std",
|
||||||
|
"winter-utils/std",
|
||||||
|
]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
blake3 = { version = "1.5", default-features = false }
|
||||||
|
clap = { version = "4.5", optional = true, features = ["derive"] }
|
||||||
|
hashbrown = { version = "0.15", optional = true, features = ["serde"] }
|
||||||
|
num = { version = "0.4", default-features = false, features = ["alloc", "libm"] }
|
||||||
|
num-complex = { version = "0.4", default-features = false }
|
||||||
|
rand = { version = "0.9", default-features = false }
|
||||||
|
rand_core = { version = "0.9", default-features = false }
|
||||||
|
rand-utils = { version = "0.12", package = "winter-rand-utils", optional = true }
|
||||||
|
rayon = { version = "1.10", optional = true }
|
||||||
|
serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] }
|
||||||
|
sha3 = { version = "0.10", default-features = false }
|
||||||
|
thiserror = { version = "2.0", default-features = false }
|
||||||
|
winter-crypto = { version = "0.12", default-features = false }
|
||||||
|
winter-math = { version = "0.12", default-features = false }
|
||||||
|
winter-utils = { version = "0.12", default-features = false }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
assert_matches = { version = "1.5", default-features = false }
|
||||||
|
criterion = { version = "0.5", features = ["html_reports"] }
|
||||||
|
getrandom = { version = "0.3", default-features = false }
|
||||||
|
hex = { version = "0.4", default-features = false, features = ["alloc"] }
|
||||||
|
proptest = { version = "1.6", default-features = false, features = ["alloc"]}
|
||||||
|
rand_chacha = { version = "0.9", default-features = false }
|
||||||
|
rand-utils = { version = "0.12", package = "winter-rand-utils" }
|
||||||
|
seq-macro = { version = "0.3" }
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
cc = { version = "1.2", optional = true, features = ["parallel"] }
|
||||||
|
glob = "0.3"
|
||||||
|
|
||||||
|
[lints.rust]
|
||||||
|
# Suppress warnings about `cfg(fuzzing)`, which is automatically set when using `cargo-fuzz`.
|
||||||
|
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }
|
Loading…
Add table
Reference in a new issue