diff options
| -rw-r--r-- | guests/sha3/Cargo.lock | 238 | ||||
| -rw-r--r-- | guests/sha3/Cargo.toml | 17 | ||||
| -rw-r--r-- | guests/sha3/default.env | 2 | ||||
| -rw-r--r-- | guests/sha3/default_private_input.toml | 258 | ||||
| -rw-r--r-- | guests/sha3/default_public_input.toml | 1 | ||||
| -rw-r--r-- | guests/sha3/src/lib.rs | 19 |
6 files changed, 535 insertions, 0 deletions
diff --git a/guests/sha3/Cargo.lock b/guests/sha3/Cargo.lock new file mode 100644 index 0000000..3d24abe --- /dev/null +++ b/guests/sha3/Cargo.lock @@ -0,0 +1,238 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "guests_macro" +version = "0.1.0" +dependencies = [ + "toml", +] + +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + +[[package]] +name = "indexmap" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "libc" +version = "0.2.171" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "proc-macro2" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + +[[package]] +name = "sha2" +version = "0.1.0" +dependencies = [ + "guests_macro", + "sha3", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "syn" +version = "2.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "toml" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "typenum" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "winnow" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63d3fcd9bba44b03821e7d699eeee959f3126dcc4aa8e4ae18ec617c2a5cea10" +dependencies = [ + "memchr", +] diff --git a/guests/sha3/Cargo.toml b/guests/sha3/Cargo.toml new file mode 100644 index 0000000..a1ce306 --- /dev/null +++ b/guests/sha3/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "sha3" +version = "0.1.0" +edition = "2021" + +[dependencies] +guests_macro = { version = "0.1.0", path = "../../guests_macro" } +sha3 = { version = "0.10.8", default-features = false } + +[features] +no_std = [] +jolt = [] +nexus = [] +risc0 = [] +sp1 = [] +zkm = [] +zkwasm = [] diff --git a/guests/sha3/default.env b/guests/sha3/default.env new file mode 100644 index 0000000..d09a649 --- /dev/null +++ b/guests/sha3/default.env @@ -0,0 +1,2 @@ +## ZKM ## +SEG_SIZE=3250 diff --git a/guests/sha3/default_private_input.toml b/guests/sha3/default_private_input.toml new file mode 100644 index 0000000..0367152 --- /dev/null +++ b/guests/sha3/default_private_input.toml @@ -0,0 +1,258 @@ +secret = [ + 188, + 191, + 150, + 164, + 254, + 227, + 130, + 168, + 15, + 98, + 124, + 58, + 253, + 144, + 66, + 244, + 158, + 254, + 81, + 20, + 238, + 152, + 68, + 180, + 30, + 150, + 214, + 17, + 215, + 126, + 20, + 11, + 196, + 218, + 231, + 70, + 35, + 34, + 154, + 155, + 138, + 28, + 239, + 227, + 60, + 126, + 217, + 38, + 244, + 24, + 211, + 96, + 67, + 202, + 133, + 116, + 222, + 181, + 255, + 51, + 236, + 236, + 193, + 102, + 15, + 126, + 207, + 176, + 33, + 64, + 226, + 182, + 150, + 95, + 253, + 223, + 103, + 222, + 55, + 240, + 159, + 200, + 197, + 91, + 248, + 161, + 215, + 194, + 208, + 9, + 125, + 214, + 143, + 103, + 7, + 5, + 30, + 116, + 221, + 107, + 27, + 2, + 108, + 72, + 54, + 4, + 74, + 70, + 9, + 129, + 244, + 228, + 240, + 68, + 59, + 61, + 27, + 197, + 229, + 48, + 177, + 10, + 223, + 97, + 44, + 113, + 95, + 47, + 128, + 215, + 143, + 174, + 221, + 140, + 125, + 219, + 235, + 116, + 86, + 139, + 121, + 46, + 218, + 80, + 175, + 153, + 104, + 125, + 210, + 144, + 64, + 143, + 130, + 34, + 195, + 225, + 59, + 66, + 141, + 119, + 102, + 42, + 78, + 55, + 236, + 229, + 165, + 135, + 119, + 45, + 254, + 229, + 38, + 65, + 143, + 46, + 15, + 243, + 68, + 150, + 219, + 169, + 194, + 233, + 82, + 88, + 4, + 178, + 70, + 100, + 150, + 241, + 248, + 78, + 69, + 117, + 44, + 176, + 31, + 21, + 145, + 81, + 77, + 184, + 17, + 164, + 160, + 122, + 100, + 120, + 29, + 232, + 103, + 155, + 76, + 214, + 195, + 55, + 35, + 57, + 43, + 160, + 112, + 27, + 240, + 173, + 53, + 45, + 215, + 222, + 41, + 23, + 134, + 127, + 118, + 237, + 173, + 111, + 43, + 172, + 157, + 213, + 219, + 37, + 220, + 90, + 184, + 143, + 113, + 242, + 54, + 8, + 235, + 12, + 47, + 50, +] diff --git a/guests/sha3/default_public_input.toml b/guests/sha3/default_public_input.toml new file mode 100644 index 0000000..6757bc6 --- /dev/null +++ b/guests/sha3/default_public_input.toml @@ -0,0 +1 @@ +hash = [100, 193, 61, 127, 159, 165, 249, 212, 252, 22, 132, 200, 202, 249, 243, 143, 154, 158, 167, 125, 251, 10, 217, 198, 38, 216, 243, 51, 177, 247, 209, 13] diff --git a/guests/sha3/src/lib.rs b/guests/sha3/src/lib.rs new file mode 100644 index 0000000..10815f4 --- /dev/null +++ b/guests/sha3/src/lib.rs @@ -0,0 +1,19 @@ +#![cfg_attr(feature = "no_std", no_std)] + +#[cfg(feature = "no_std")] +extern crate alloc; +#[cfg(feature = "no_std")] +use alloc::vec::Vec; + +use sha3::{Digest, Keccak256}; + +#[guests_macro::proving_entrypoint] +pub fn main(secret: Vec<u8>, hash: Vec<u8>) -> bool { + let mut hasher = Keccak256::new(); + hasher.update(secret); + let result = hasher.finalize(); + + let output: [u8; 32] = result.into(); + + output.to_vec() == hash +} |
