zkpyc-stdlib 0.1.0-dev

Standard library for the ZKPyC compiler.
Documentation
1
2
3
4
5
6
7
8
from zkpyc.types import Array, field # zk_ignore
from zkpyc.stdlib.EMBED import unpack

# Unpack a field element as 254 big endian bits without checking for overflows
# This does *not* guarantee a single output: for example, 0 can be decomposed as 0 or as P and this function does not enforce either
def unpack_unchecked(i: field) -> Array[bool, 254]:
    res: Array[bool, 254] = unpack(i, 254)
    return res