From ec0fae56dcda4827fe63d59d00ff123f1581aa85 Mon Sep 17 00:00:00 2001 From: Bazsalanszky Date: Tue, 6 Dec 2022 20:48:34 +0100 Subject: [PATCH] Fixed ZoKrates compile error --- CCTF_Solutions_main/.gitignore | 4 +++- CCTF_Solutions_main/root.zok | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CCTF_Solutions_main/.gitignore b/CCTF_Solutions_main/.gitignore index 33c8cdb..d4b3ca9 100644 --- a/CCTF_Solutions_main/.gitignore +++ b/CCTF_Solutions_main/.gitignore @@ -140,4 +140,6 @@ crashlytics.properties crashlytics-build.properties fabric.properties -.zokrates \ No newline at end of file +.zokrates +# Ignore Gradle build output directory +build diff --git a/CCTF_Solutions_main/root.zok b/CCTF_Solutions_main/root.zok index e1a4e35..3d66bde 100644 --- a/CCTF_Solutions_main/root.zok +++ b/CCTF_Solutions_main/root.zok @@ -1,10 +1,11 @@ import "hashes/sha256/sha256Padded.zok" as sha256; 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) -> u32[8]{ u8[20] addr8 = cast(address); u32[8] genHash = sha256(flag); log("Hash: {} {} {} {} {} {} {} {}",genHash[0],genHash[1],genHash[2],genHash[3],genHash[4],genHash[5],genHash[6],genHash[7]); assert(genHash == hash); - return sha256([...addr8,...sha256(flag)]); + u8[32] hash8 = cast(hash); + return sha256([...addr8,...hash8]); } \ No newline at end of file