aboutsummaryrefslogtreecommitdiff
path: root/guests/sha3/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'guests/sha3/src/lib.rs')
-rw-r--r--guests/sha3/src/lib.rs19
1 files changed, 19 insertions, 0 deletions
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
+}