aboutsummaryrefslogtreecommitdiff
path: root/guests/sha3/src/lib.rs
blob: 10815f43ad5ae632acd5834cfe69aaf602309185 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
}