Documentation ¶
Index ¶
- Variables
- func Addr2Hex(a common.Address) string
- func Addr2Hex0x(a common.Address) string
- func ArrayBytes2Hex0x(in [][]byte) []string
- func ArrayHex2Hash(in []string) [][32]byte
- func Byte32ToBits(api frontend.API, b32 Bytes32, frSize int) []frontend.Variable
- func Byte32ToFrBits(b32 [2]*big.Int, frSize int) []uint
- func Bytes2Addr(b []byte) common.Address
- func Bytes2AddrHex(b []byte) string
- func Bytes2AddrHex0x(b []byte) string
- func Bytes2Hash(b []byte) common.Hash
- func Bytes2Hex(b []byte) string
- func Bytes2Hex0x(b []byte) string
- func CalculateAppVkHashForBn254(...) []byte
- func CalculateAppVkHashForBn254InCircuit(api frontend.API, ...) (frontend.Variable, error)
- func DecomposeBits(data *big.Int, length int) []uint
- func FlipByGroups[T any](in []T, groupSize int) []T
- func FormatAddrHex(s string) string
- func GetHexArray(hexStr string, maxLen int) (res []frontend.Variable)
- func Hex2Addr(s string) common.Address
- func Hex2BigInt(s string) *big.Int
- func Hex2Bytes(s string) (b []byte)
- func Hex2Hash(s string) common.Hash
- func IsValidTxHash(txHash string) bool
- func MiMCBlockPad0(data []byte, blockSize int) []byte
- func PackBitsToInt(bits []uint) []*big.Int
- func Pad20Bytes(in []byte) []byte
- func Pad32Bytes(in []byte) []byte
- func ParseBytes32(data []byte, frSize int) [2]*big.Int
- func Recompose32ByteToNibbles(api frontend.API, trunk []frontend.Variable) [64]frontend.Variable
- func Recompose6BytesToNibbles(api frontend.API, d frontend.Variable) [12]frontend.Variable
- func RecomposeSDKByte32ToNibble(api frontend.API, b32 Bytes32) [64]frontend.Variable
- func Reverse[S ~[]E, E any](s S) S
- func Strings2bytes(rs []string) (ret [][]byte)
- func Var2BigInt(input interface{}) *big.Int
- type Bytes32
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Addr2Hex0x ¶
func ArrayBytes2Hex0x ¶
func ArrayHex2Hash ¶
func Byte32ToBits ¶
func Bytes2Addr ¶
Bytes2Addr returns Address from b Addr.Bytes() does the reverse
func Bytes2AddrHex0x ¶
func Bytes2Hex0x ¶
func CalculateAppVkHashForBn254 ¶
func CalculateAppVkHashForBn254(vk replonk.VerifyingKey[sw_bn254.ScalarField, sw_bn254.G1Affine, sw_bn254.G2Affine]) []byte
func DecomposeBits ¶
DecomposeBits returns little endian bits of data
func FlipByGroups ¶
FlipByGroups flips the order of the groups of groupSize. e.g. [1,2,3,4,5,6] with groupSize 2 is flipped to [5,6,3,4,1,2]
func FormatAddrHex ¶
FormatAddrHex formats a string into standard Addr string
func Hex2BigInt ¶
func Hex2Bytes ¶
Hex2Bytes supports hex string with or without 0x prefix Calls hex.DecodeString directly and ignore err similar to ec.FromHex but better
func IsValidTxHash ¶
IsValidTxHash verifies whether a string can represent a valid hash or not.
func MiMCBlockPad0 ¶
MiMCBlockPad0 pad 0 into miMC block up to specific block size in Big-Endian
func PackBitsToInt ¶
func Pad20Bytes ¶
if in is 20 bytes, return directly. otherwise return a new []byte w/ len 20, left pad 0x00..[in] if len(in)>20, panic
func Pad32Bytes ¶
func ParseBytes32 ¶
ParseBytes32 decomposes data (big endian) into little endian bits then recomposes the result into two big ints in the form of {lo, hi}
func Strings2bytes ¶
func Var2BigInt ¶
copied from https://github.com/Consensys/gnark/blob/5711c4ae475535ce2a0febdeade86ff98914a378/internal/utils/convert.go#L39C1-L39C1 with minor changes