Updated zkp scheme

frontend
Bazsalanszky 2022-12-06 20:34:54 +01:00
parent 22afd9e197
commit 06b80d8cde
No known key found for this signature in database
GPG Key ID: B40814F4EFE23F96
2 changed files with 3 additions and 5 deletions

View File

@ -1,11 +1,10 @@
import "hashes/sha256/sha256Padded.zok" as sha256; import "hashes/sha256/sha256Padded.zok" as sha256;
from "utils/casts.zok" import cast; from "utils/casts.zok" import cast;
def main(public u32[5] address,private u8[64] flag) { def main(public u32[5] address,private u8[64] flag) -> u32[8] {
u8[20] addr8 = cast(address); u8[20] addr8 = cast(address);
u8[84] forHash = [...addr8,...flag];
u32[8] genHash = sha256(flag); u32[8] genHash = sha256(flag);
log("Hash: {} {} {} {} {} {} {} {}",genHash[0],genHash[1],genHash[2],genHash[3],genHash[4],genHash[5],genHash[6],genHash[7]); log("Hash: {} {} {} {} {} {} {} {}",genHash[0],genHash[1],genHash[2],genHash[3],genHash[4],genHash[5],genHash[6],genHash[7]);
//assert(genHash == hash); //assert(genHash == hash);
return; return genHash;
} }

View File

@ -3,9 +3,8 @@ from "utils/casts.zok" import cast;
def main(public u32[8] hash,public u32[5] address,private u8[64] flag) { def main(public u32[8] hash,public u32[5] address,private u8[64] flag) {
u8[20] addr8 = cast(address); u8[20] addr8 = cast(address);
u8[84] forHash = [...addr8,...flag];
u32[8] genHash = sha256(flag); u32[8] genHash = sha256(flag);
log("Hash: {} {} {} {} {} {} {} {}",genHash[0],genHash[1],genHash[2],genHash[3],genHash[4],genHash[5],genHash[6],genHash[7]); log("Hash: {} {} {} {} {} {} {} {}",genHash[0],genHash[1],genHash[2],genHash[3],genHash[4],genHash[5],genHash[6],genHash[7]);
assert(genHash == hash); assert(genHash == hash);
return; return sha256([...addr8,...sha256(flag)]);
} }