mirror of
https://github.com/fluencelabs/lazy-snark
synced 2025-04-24 14:32:14 +00:00
19 lines
591 B
Plaintext
19 lines
591 B
Plaintext
|
import "hashes/sha256/512bitPacked.code" as sha256packed
|
||
|
|
||
|
def main(private field[4] n_old, private field[4] n_new, field[2] hash_old, field[2] hash_new) -> (field):
|
||
|
|
||
|
//check sum
|
||
|
n_old[0] + n_old[1] + n_old[2] + n_old[3] == n_new[0] + n_new[1] + n_new[2] + n_new[3]
|
||
|
|
||
|
// check old hash
|
||
|
h_old = sha256packed([n_old[0], n_old[1], n_old[2], n_old[3]])
|
||
|
h_old[0] == hash_old[0]
|
||
|
h_old[1] == hash_old[1]
|
||
|
|
||
|
// check new hash
|
||
|
h_new = sha256packed([n_new[0], n_new[1], n_new[2], n_new[3]])
|
||
|
h_new[0] == hash_new[0]
|
||
|
h_new[1] == hash_new[1]
|
||
|
|
||
|
return 1
|