1
0
Fork 0
mirror of synced 2025-09-23 12:18:44 +00:00
ZoKrates/zokrates_cli/examples/TestStdlib/hashes/sha256/test512bitPacked.code
2019-01-31 13:29:16 +01:00

31 lines
No EOL
884 B
Text

// Python code used to create test vector:
// import hashlib
// preimage = bytes.fromhex('00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\
// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 05')
// bin(int(preimage.hex(), 16))
// # '0b101'
// digest = hashlib.sha256(preimage).hexdigest()
// # digest = 'c6481e22c5ff4164af680b8cfaa5e8ed3120eeff89c4f307c4a6faaae059ce10'
// int(digest[:32], 16)
// # 263561599766550617289250058199814760685
// int(digest[32:], 16)
// # 65303172752238645975888084098459749904
import "hashes/sha256/512bitPacked.code" as sha256packed
def main() -> (field):
field a = 0
field b = 0
field c = 0
field d = 5
h = sha256packed([a, b, c, d])
h[0] == 263561599766550617289250058199814760685
h[1] == 65303172752238645975888084098459749904
return 1