aboutsummaryrefslogtreecommitdiff
path: root/guests
diff options
context:
space:
mode:
Diffstat (limited to 'guests')
-rw-r--r--guests/keccak/Cargo.lock24
-rw-r--r--guests/keccak/Cargo.toml7
-rw-r--r--guests/keccak/src/lib.rs10
3 files changed, 35 insertions, 6 deletions
diff --git a/guests/keccak/Cargo.lock b/guests/keccak/Cargo.lock
index 69063a0..5136a4d 100644
--- a/guests/keccak/Cargo.lock
+++ b/guests/keccak/Cargo.lock
@@ -116,7 +116,9 @@ name = "keccak"
version = "0.1.0"
dependencies = [
"guests_macro",
- "sha3",
+ "sha3 0.10.6",
+ "sha3 0.10.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "sha3 0.10.8 (git+https://github.com/sp1-patches/RustCrypto-hashes?tag=patch-sha3-0.10.8-sp1-4.0.0)",
"zkm-runtime",
]
@@ -252,6 +254,15 @@ dependencies = [
[[package]]
name = "sha3"
+version = "0.10.6"
+source = "git+https://github.com/risc0/RustCrypto-hashes?tag=sha3-v0.10.6#7a187e934c1f6c68e4b4e5cf37541b7a0d64d303"
+dependencies = [
+ "digest",
+ "keccak 0.1.5",
+]
+
+[[package]]
+name = "sha3"
version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60"
@@ -261,6 +272,15 @@ dependencies = [
]
[[package]]
+name = "sha3"
+version = "0.10.8"
+source = "git+https://github.com/sp1-patches/RustCrypto-hashes?tag=patch-sha3-0.10.8-sp1-4.0.0#8f6d303c0861ba7e5adcc36207c0f41fe5edaabc"
+dependencies = [
+ "digest",
+ "keccak 0.1.5",
+]
+
+[[package]]
name = "syn"
version = "2.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -361,6 +381,7 @@ dependencies = [
[[package]]
name = "zkm-precompiles"
version = "0.2.0"
+source = "git+https://github.com/zkMIPS/zkm.git#eb09cf6c81bed9717bc98e4a4c9a61f54787a351"
dependencies = [
"bincode",
"cfg-if",
@@ -371,6 +392,7 @@ dependencies = [
[[package]]
name = "zkm-runtime"
version = "0.2.0"
+source = "git+https://github.com/zkMIPS/zkm.git#eb09cf6c81bed9717bc98e4a4c9a61f54787a351"
dependencies = [
"bincode",
"bytemuck",
diff --git a/guests/keccak/Cargo.toml b/guests/keccak/Cargo.toml
index beaa70e..aaf3d2a 100644
--- a/guests/keccak/Cargo.toml
+++ b/guests/keccak/Cargo.toml
@@ -8,11 +8,14 @@ guests_macro = { version = "0.1.0", path = "../../guests_macro" }
sha3 = { version = "0.10.8", default-features = false }
zkm-runtime = { git = "https://github.com/zkMIPS/zkm.git", optional = true } # patched by the guest wrapper
+sha3-sp1 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha3", tag = "patch-sha3-0.10.8-sp1-4.0.0", optional = true }
+sha3-risc0 = { git = "https://github.com/risc0/RustCrypto-hashes", package = "sha3", tag = "sha3-v0.10.6", optional = true }
+
[features]
no_std = []
jolt = []
nexus = []
-risc0 = []
-sp1 = []
+risc0 = ["sha3-risc0"]
+sp1 = ["sha3-sp1"]
zkm = ["zkm-runtime"]
zkwasm = []
diff --git a/guests/keccak/src/lib.rs b/guests/keccak/src/lib.rs
index 4808442..df15ae2 100644
--- a/guests/keccak/src/lib.rs
+++ b/guests/keccak/src/lib.rs
@@ -5,9 +5,13 @@ extern crate alloc;
#[cfg(feature = "no_std")]
use alloc::vec::Vec;
-#[cfg(feature = "zkm")]
-use zkm_runtime::*;
+#[cfg(feature = "sp1")]
+use sha3_sp1::{Digest, Keccak256};
+#[cfg(feature = "risc0")]
+use sha3_risc0::{Digest, Keccak256};
+
+#[cfg(not(any(feature = "zkm", feature = "sp1", feature = "risc0")))]
use sha3::{Digest, Keccak256};
#[guests_macro::proving_entrypoint]
@@ -15,7 +19,7 @@ pub fn main(secret: Vec<u8>, hash: Vec<u8>) -> bool {
#[cfg(feature = "zkm")]
let result = zkm_runtime::io::keccak(&secret.as_slice());
- #[cfg(not(any(feature = "zkm")))]
+ #[cfg(not(feature = "zkm"))]
let result = {
let mut hasher = Keccak256::new();
hasher.update(secret);