diff --git a/risc0/short_tree_test/short_tree_proof.sh b/risc0/short_tree_test/short_tree_proof.sh old mode 100644 new mode 100755 diff --git a/risc0/single_hash/methods/guest/src/main.rs b/risc0/single_hash/methods/guest/src/main.rs index 190dc39..18b58db 100644 --- a/risc0/single_hash/methods/guest/src/main.rs +++ b/risc0/single_hash/methods/guest/src/main.rs @@ -1,10 +1,9 @@ +use k256::elliptic_curve::group::GroupEncoding; use risc0_zkvm::{ guest::env, sha::{Impl, Sha256}, }; use zerocopy::IntoBytes; -use k256::elliptic_curve::group::GroupEncoding; - fn main() { // read the input @@ -21,21 +20,18 @@ fn main() { //version //owner - let mut array2 = [owner.to_bytes()]; - let mut array3 = [amount.try_into().unwrap()]; - //storage - let array4 = [ nonce.try_into().unwrap(), - privacy, - const1.try_into().unwrap(), - const2.try_into().unwrap(),]; - //array2.clone_from_slice(&array3); - array3.clone_from_slice(&array4); + let mut bytes_to_hash: [u8; 66] = [0; 66]; - //array1.clone_from_slice(&array3); - //array1.clone_from_slice(array4); - - let _hash = Impl::hash_bytes(&array3); + let owner_bytes: [u8; 33] = owner.to_bytes().try_into().unwrap(); + bytes_to_hash[..33].copy_from_slice(&owner_bytes); + bytes_to_hash[33..41].copy_from_slice(&amount.to_le_bytes()); + bytes_to_hash[41..49].copy_from_slice(&nonce.to_le_bytes()); + bytes_to_hash[49..50].copy_from_slice(&privacy.to_le_bytes()); + bytes_to_hash[50..58].copy_from_slice(&const1.to_le_bytes()); + bytes_to_hash[58..].copy_from_slice(&const2.to_le_bytes()); + + let _hash = Impl::hash_bytes(&bytes_to_hash); // write public output to the journal env::commit(&input); -} \ No newline at end of file +} diff --git a/risc0/single_hash/single_hash_without_proof.sh b/risc0/single_hash/single_hash_without_proof.sh old mode 100644 new mode 100755