internal

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BreakUpBytesIntoBitsHint

func BreakUpBytesIntoBitsHint(_ *big.Int, ins, outs []*big.Int) error

func BreakUpBytesIntoCrumbsHint

func BreakUpBytesIntoCrumbsHint(_ *big.Int, ins, outs []*big.Int) error

func BreakUpBytesIntoHalfHint

func BreakUpBytesIntoHalfHint(_ *big.Int, ins, outs []*big.Int) error

Types

type RangeChecker

type RangeChecker struct {
	// contains filtered or unexported fields
}

TODO Use std/rangecheck instead

func NewRangeChecker

func NewRangeChecker(api frontend.API) *RangeChecker

func (*RangeChecker) AssertLessThan

func (r *RangeChecker) AssertLessThan(bound uint, c ...frontend.Variable)

func (*RangeChecker) BreakUpBytesIntoWords

func (r *RangeChecker) BreakUpBytesIntoWords(wordNbBits int, bytes ...frontend.Variable) (words, recombined []frontend.Variable)

BreakUpBytesIntoWords breaks up bytes into words of size wordNbBits It also returns a Slice of bytes which are a reading of the input byte Slice starting from each of the words, thus a super-Slice of the input It has the side effect of checking that the input does in fact consist of bytes As an example, let the words be bits and the input be the bytes [b₀ b₁ b₂ b₃ b₄ b₅ b₆ b₇], [b₈ b₉ b₁₀ b₁₁ b₁₂ b₁₃ b₁₄ b₁₅] Then the output words are b₀, b₁, b₂, b₃, b₄, b₅, b₆, b₇, b₈, b₉, b₁₀, b₁₁, b₁₂, b₁₃, b₁₄, b₁₅ The "recombined" output is the slice {[b₀ b₁ b₂ b₃ b₄ b₅ b₆ b₇], [b₁ b₂ b₃ b₄ b₅ b₆ b₇ b₈], ...} Note that for any i in range we get recombined[8*i] = bytes[i]

func (*RangeChecker) IsLessThan

func (r *RangeChecker) IsLessThan(bound uint, c frontend.Variable) frontend.Variable

IsLessThan returns a variable that is 1 if 0 ≤ c < bound, 0 otherwise TODO perf @Tabaie see if we can get away with a weaker contract, where the return value is 0 iff 0 ≤ c < bound

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL