Skip to content

Instantly share code, notes, and snippets.

@vrde
Last active July 10, 2019 14:24
Show Gist options
  • Save vrde/16152b28861dedaf84a9ce7af5fe7b8a to your computer and use it in GitHub Desktop.
Save vrde/16152b28861dedaf84a9ce7af5fe7b8a to your computer and use it in GitHub Desktop.
import "hashes/sha256/256bitPadded.code" as sha256
import "utils/pack/unpack128.code" as unpack128
import "utils/pack/pack128.code" as pack128
def main(private field a, private field b) -> (field[2]):
field[128] a128 = unpack128(a)
field[128] b128 = unpack128(b)
h = sha256([...a128, ...b128])
return [pack128(h[0..128]), pack128(h[128..256])]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment