sCrypt-Inc / zokrates

A zero-knowledge proof toolbox on Bitcoin. A fork of zokrates (https://github.com/Zokrates/ZoKrates).
GNU Lesser General Public License v3.0
14 stars 1 forks source link

add show opening publickeys #21

Closed zhfnjust closed 3 years ago

zhfnjust commented 3 years ago

sha256 code


import "hashes/sha256/256bitPadded" as sha256
import "utils/pack/u32/unpack128" as unpack128
import "utils/pack/u32/pack128" as pack128
def main(private field[2] preimage, field h0, field h1):

    u32[4] a_bits = unpack128(preimage[0])
    u32[4] b_bits = unpack128(preimage[1])
    u32[8] privkey = [...a_bits, ...b_bits]
    u32[8] res = sha256(privkey)

    assert(h0 == pack128(res[0..4]))
    assert(h1 == pack128(res[4..8]))

    return

witness

./target/release/zokrates compute-witness -a 0 1 314077308411032793321278816725012958289 316495952764820137513325325447450102725

output

Performing verification...
Performing sucessfully, opening publickeys: ["ecf6799f7c6acb99a9419536d3642a1ecd9820b46384556bbe6cdcbbab93063c19626e32e40ebd2c9bcb487f4df75437922a077cbcdf05c016960f3303f0b812", "e9382b707caffd67664333e3688405fcef1ac54fbf65c68ca99672c98b8763f769fdec8fad54cf3255cb8e13b3ac24d82cd4416b29229fa473f3b6d533cb8b77"]
total gates:  199624...