diff options
| author | Kamen Mladenov <kamen@syndamia.com> | 2025-04-14 13:33:22 +0300 |
|---|---|---|
| committer | Kamen Mladenov <kamen@syndamia.com> | 2025-04-14 13:40:57 +0300 |
| commit | 0c54fb0540591ab5ddcb4de2a2ff7fc54bd3b798 (patch) | |
| tree | a514f8b0ed50ae07baddedc675786611cd6093dd /guests | |
| parent | b4841b1479bf6be5958a850083052badc4c027fa (diff) | |
| download | zkVMs-benchmarks-0c54fb0540591ab5ddcb4de2a2ff7fc54bd3b798.tar zkVMs-benchmarks-0c54fb0540591ab5ddcb4de2a2ff7fc54bd3b798.tar.gz zkVMs-benchmarks-0c54fb0540591ab5ddcb4de2a2ff7fc54bd3b798.zip | |
feat(guests/sha256): Add SP1 and RISC0 precompile usage
Diffstat (limited to 'guests')
| -rw-r--r-- | guests/sha256/Cargo.lock | 32 | ||||
| -rw-r--r-- | guests/sha256/Cargo.toml | 7 | ||||
| -rw-r--r-- | guests/sha256/src/lib.rs | 7 |
3 files changed, 39 insertions, 7 deletions
diff --git a/guests/sha256/Cargo.lock b/guests/sha256/Cargo.lock index b966cc1..e064cd9 100644 --- a/guests/sha256/Cargo.lock +++ b/guests/sha256/Cargo.lock @@ -146,17 +146,19 @@ dependencies = [ [[package]] name = "sha2" -version = "0.1.0" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "guests_macro", - "sha2 0.10.8", + "cfg-if", + "cpufeatures", + "digest", ] [[package]] name = "sha2" version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +source = "git+https://github.com/sp1-patches/RustCrypto-hashes?tag=patch-sha2-0.10.8-sp1-4.0.0#1f224388fdede7cef649bce0d63876d1a9e3f515" dependencies = [ "cfg-if", "cpufeatures", @@ -164,6 +166,26 @@ dependencies = [ ] [[package]] +name = "sha2" +version = "0.10.8" +source = "git+https://github.com/risc0/RustCrypto-hashes?tag=sha2-v0.10.8-risczero.0#244dc3b08788f7a4ccce14c66896ae3b4f24c166" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha256" +version = "0.1.0" +dependencies = [ + "guests_macro", + "sha2 0.10.8 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.10.8 (git+https://github.com/sp1-patches/RustCrypto-hashes?tag=patch-sha2-0.10.8-sp1-4.0.0)", + "sha2 0.10.8 (git+https://github.com/risc0/RustCrypto-hashes?tag=sha2-v0.10.8-risczero.0)", +] + +[[package]] name = "syn" version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/guests/sha256/Cargo.toml b/guests/sha256/Cargo.toml index fccbfa7..672d340 100644 --- a/guests/sha256/Cargo.toml +++ b/guests/sha256/Cargo.toml @@ -7,11 +7,14 @@ edition = "2021" guests_macro = { version = "0.1.0", path = "../../guests_macro" } sha2 = { version = "0.10.8", default-features = false } +sha2-sp1 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", tag = "patch-sha2-0.10.8-sp1-4.0.0", optional = true } +sha2-risc0 = { git = "https://github.com/risc0/RustCrypto-hashes", package = "sha2", tag = "sha2-v0.10.8-risczero.0", optional = true } + [features] no_std = [] jolt = [] nexus = [] -risc0 = [] -sp1 = [] +risc0 = ["sha2-risc0"] +sp1 = ["sha2-sp1"] zkm = [] zkwasm = [] diff --git a/guests/sha256/src/lib.rs b/guests/sha256/src/lib.rs index 1ca7f72..885f58a 100644 --- a/guests/sha256/src/lib.rs +++ b/guests/sha256/src/lib.rs @@ -5,6 +5,13 @@ extern crate alloc; #[cfg(feature = "no_std")] use alloc::vec::Vec; +#[cfg(feature = "sp1")] +use sha2_sp1::{Digest, Sha256}; + +#[cfg(feature = "risc0")] +use sha2_risc0::{Digest, Sha256}; + +#[cfg(not(any(feature = "sp1", feature = "risc0")))] use sha2::{Digest, Sha256}; #[guests_macro::proving_entrypoint] |
