Crate snarkvm_console_algorithms

Source

Re-exports§

pub use bhp::BHP;
pub use bhp::BHP256;
pub use bhp::BHP512;
pub use bhp::BHP768;
pub use bhp::BHP1024;

Modules§

bech32
Encoding and decoding of the Bech32 format
bhp
de
Generic data structure deserialization framework.
environment
error
field
fmt
Utilities for formatting and printing strings.
group
integer_magnitude
Trait pattern to prevent abuse of Magnitude.
integer_type
integers
scalar
ser
Generic data structure serialization framework.
str
String manipulation.
string_parser
From https://github.com/Geal/nom/blob/main/examples/string.rs
variable_length

Macros§

anyhow
Construct an ad-hoc error from a string or existing non-anyhow error value.
bail
Return early with an error.
cfg_chunks
Returns an iterator over chunk_size elements of the slice at a time.
cfg_find
Finds the first element that satisfies the predicate function
cfg_find_map
Applies a function and returns the first value that is not None
cfg_into_iter
Creates parallel iterator if parallel feature is enabled.
cfg_iter
Creates parallel iterator over refs if parallel feature is enabled.
cfg_iter_mut
Creates parallel iterator over mut refs if parallel feature is enabled.
cfg_keys
Turns a collection into an iterator.
cfg_reduce
Applies the reduce operation over an iterator.
cfg_values
Turns a collection into an iterator.
ensure
Return early with an error if a condition is not satisfied.
to_bits_le
Takes as input a sequence of objects, and converts them to a series of little-endian bits. All traits that implement ToBits can be automatically converted to bits in this manner.

Structs§

Alphanumeric
Sample a u8, uniformly distributed over ASCII letters and numbers: a-z, A-Z and 0-9.
Blake2Xs
Console
Elligator2
Error
The Error type, a wrapper around a dynamic error type.
Field
Formatter
Configuration for formatting.
FromBytesDeserializer
Group
Keccak
The sponge construction Sponge[f, pad, r] is a function that takes a variable-length input and produces a fixed-length output (the hash value).
LimitedWriter
A wrapper around a Write instance that limits the number of bytes that can be written.
Pedersen
Pedersen is a collision-resistant hash function that takes a variable-length input. The Pedersen hash function does not behave like a random oracle, see Poseidon for one.
Poseidon
Sanitizer
Scalar
Standard
A generic random value distribution, implemented for many primitive types. Usually generates values with a numerically uniform distribution, and with a range appropriate to the type.
TestRng
A fast RNG used solely for testing and benchmarking, not for any real world purposes.
ToBytesSerializer

Enums§

Err
The Err enum indicates the parser was not successful
ErrorKind
Indicates which parser returned an error
Ordering
An Ordering is the result of a comparison between two values.

Traits§

AbsChecked
Unary operator for retrieving the absolute value, enforcing an overflow never occurs.
AbsSaturating
Unary operator for retrieving the absolute value, bounding the difference to MAX if an overflow occurs.
AbsWrapped
Unary operator for retrieving the absolute value, wrapping the result if an overflow occurs.
Add
The addition operator +.
AddAssign
The addition assignment operator +=.
AddChecked
Binary operator for adding two values, enforcing an overflow never occurs.
AddSaturating
Binary operator for adding two values, bounding the sum to MAX if an overflow occurs.
AddWrapped
Binary operator for adding two values, wrapping the sum if an overflow occurs.
AddressTrait
Representation of an address.
AffineCurve
Affine representation of an elliptic curve point guaranteed to be in the correct prime order subgroup.
AsPrimitive
A generic interface for casting between machine scalars with the as operator, which admits narrowing and precision loss. Implementers of this trait AsPrimitive should behave like a primitive numeric type (e.g. a newtype around another primitive), and the intended conversion must never fail.
BitAnd
The bitwise AND operator &.
BitAndAssign
The bitwise AND assignment operator &=.
BitOr
The bitwise OR operator |.
BitOrAssign
The bitwise OR assignment operator |=.
BitXor
The bitwise XOR operator ^.
BitXorAssign
The bitwise XOR assignment operator ^=.
BooleanTrait
Representation of a boolean.
CheckedPow
CheckedShl
Commit
A trait for a commitment scheme.
CommitUncompressed
A trait for a commitment scheme.
Compare
Trait for comparator operations.
CryptoRng
A marker trait used to indicate that an RngCore or BlockRngCore implementation is supposed to be cryptographically secure.
Debug
? formatting.
Deref
Used for immutable dereferencing operations, like *v.
DerefMut
Used for mutable dereferencing operations, like in *v = 1;.
Deserialize
A data structure that can be deserialized from any data format supported by Serde.
DeserializeExt
A helper trait used to simplify value extraction.
DeserializeOwned
A data structure that can be deserialized without borrowing any data from the deserializer.
Deserializer
A data format that can deserialize any data structure supported by Serde.
Display
Format trait for an empty format, {}.
Distribution
Types (distributions) that can be used to create a random instance of T.
Div
The division operator /.
DivAssign
The division assignment operator /=.
DivChecked
Binary operator for dividing two values, enforcing an overflow never occurs.
DivSaturating
Binary operator for dividing two values, bounding the quotient to MAX or MIN if an overflow occurs.
DivUnchecked
Binary operator for dividing two values, without checking specific conditions.
DivWrapped
Binary operator for dividing two values, wrapping the quotient if an overflow occurs.
Double
Unary operator for retrieving the doubled value.
EnumAccess
Provides a Visitor access to the data of an enum in the input.
Environment
Equal
Trait for equality comparisons.
FieldTrait
Representation of a base field element.
FromBase32
Parse/convert base32 slice to Self. It is the reciprocal of ToBase32.
FromBits
FromBytes
FromField
Unary operator for converting from a base field element.
FromFields
Unary operator for converting from a list of base elements.
FromStr
Parse a value from a string
GroupTrait
Representation of a group element.
Hash
A trait for a hash function.
HashMany
A trait for a hash function that produces multiple outputs.
HashToGroup
A trait for a hash function that projects the value to an affine group element.
HashToScalar
A trait for a hash function that projects the value to a scalar.
HashUncompressed
A trait for a hash function of an uncompressed variant.
IntegerCore
IntegerProperties
Properties common to all integer types.
IntegerTrait
Representation of an integer.
IntegerType
Trait bound for integer values. Common to both signed and unsigned integers.
Inverse
Unary operator for retrieving the inverse value.
Itertools
An Iterator blanket implementation that provides extra adaptors and methods.
Magnitude
Trait for integers that can be used as an unsigned magnitude. Magnitudes are either used to represent an integer exponent or the right operand in integer shift operations.
MapAccess
Provides a Visitor access to each entry of a map in the input.
Modulo
Binary operator for modding two values.
MontgomeryParameters
Mul
The multiplication operator *.
MulAssign
The multiplication assignment operator *=.
MulChecked
Binary operator for multiplying two values, enforcing an overflow never occurs.
MulSaturating
Binary operator for multiplying two values, bounding the product to MAX if an overflow occurs.
MulWrapped
Binary operator for multiplying two values, wrapping the product if an overflow occurs.
Nand
Binary operator for performing NOT (a AND b).
Neg
The unary negation operator -.
Nor
Binary operator for performing (NOT a) AND (NOT b).
Not
The unary logical negation operator !.
One
Defines a multiplicative identity element for Self.
OrHalt
A trait to unwrap a Result or Halt.
PRF
A trait for a pseudorandom function.
Parser
Operations to parse a string literal into an object.
Pow
Binary operator for raising a value to a power.
PowChecked
Binary operator for exponentiating two values, enforcing an overflow never occurs.
PowWrapped
Binary operator for exponentiating two values, wrapping the result if an overflow occurs.
Product
Trait to represent types that can be created by multiplying elements of an iterator.
ProjectiveCurve
Projective representation of an elliptic curve point guaranteed to be in the prime order subgroup.
Read
The Read trait allows for reading bytes from a source.
Rem
The remainder operator %.
RemAssign
The remainder assignment operator %=.
RemChecked
Binary operator for dividing two values and returning the remainder, enforcing an overflow never occurs.
RemSaturating
Binary operator for dividing two values, bounding the remainder to MAX or MIN if an overflow occurs.
RemWrapped
Binary operator for dividing two values, wrapping the remainder if an overflow occurs.
Rng
An automatically-implemented extension trait on RngCore providing high-level generic methods for sampling values and other convenience methods.
ScalarTrait
Representation of a scalar field element.
SeqAccess
Provides a Visitor access to each element of a sequence in the input.
Serialize
A data structure that can be serialized into any data format supported by Serde.
SerializeSeq
Returned from Serializer::serialize_seq.
SerializeStruct
Returned from Serializer::serialize_struct.
Serializer
A data format that can serialize any data structure supported by Serde.
Shl
The left shift operator <<. Note that because this trait is implemented for all integer types with multiple right-hand-side types, Rust’s type checker has special handling for _ << _, setting the result type for integer operations to the type of the left-hand-side operand. This means that though a << b and a.shl(b) are one and the same from an evaluation standpoint, they are different when it comes to type inference.
ShlAssign
The left shift assignment operator <<=.
ShlChecked
Binary operator for left shifting a value, checking that the rhs is less than the number of bits in self.
ShlWrapped
Binary operator for left shifting a value, safely continuing past the number of bits in self.
Shr
The right shift operator >>. Note that because this trait is implemented for all integer types with multiple right-hand-side types, Rust’s type checker has special handling for _ >> _, setting the result type for integer operations to the type of the left-hand-side operand. This means that though a >> b and a.shr(b) are one and the same from an evaluation standpoint, they are different when it comes to type inference.
ShrAssign
The right shift assignment operator >>=.
ShrChecked
Binary operator for right shifting a value, checking that the rhs is less than the number of bits in self.
ShrWrapped
Binary operator for right shifting a value, safely continuing past the number of bits in self.
SizeInBits
SizeInBytes
SizeInDataBits
Square
Unary operator for retrieving the squared value.
SquareRoot
Unary operator for retrieving the square root of the value.
StringTrait
Representation of a string.
Sub
The subtraction operator -.
SubAssign
The subtraction assignment operator -=.
SubChecked
Binary operator for subtracting two values, enforcing an underflow never occurs.
SubSaturating
Binary operator for subtracting two values, bounding the difference to MIN if an underflow occurs.
SubWrapped
Binary operator for subtracting two values, wrapping the difference if an underflow occurs.
Sum
Trait to represent types that can be created by summing up an iterator.
Ternary
Trait for ternary operations.
ToBase32
A trait for converting a value to a type T that represents a u5 slice.
ToBits
ToBytes
ToField
Unary operator for converting to a base field.
ToFields
Unary operator for converting to a list of base fields.
TwistedEdwardsParameters
TypeName
Uniform
A trait for a uniform random number generator.
VariantAccess
VariantAccess is a visitor that is created by the Deserializer and passed to the Deserialize to deserialize the content of a particular enum variant.
Visibility
Visitor
This trait represents a visitor that walks through a deserializer.
WrappingDiv
WrappingPow
WrappingRem
Write
A trait for objects which are byte-oriented sinks.
Zero
Defines an additive identity element for Self.
_
The interface for a generic field.

Functions§

alpha1
Recognizes one or more lowercase and uppercase ASCII alphabetic characters: a-z, A-Z
alphanumeric1
Recognizes one or more ASCII numerical and alphabetic characters: 0-9, a-z, A-Z
alt
Tests a list of parsers one by one until one succeeds.
char
Recognizes one character.
complete
Transforms Incomplete into Error.
convert_result
Converts a ParserResult into a human-readable message.
count
Runs the embedded parser count times, gathering the results in a Vec
error
fail
A parser which always fails.
has_duplicates
Returns true if the given iterator has duplicate elements.
make_error
Creates an error from the input position and an ErrorKind
many0
Repeats the embedded parser, gathering the results in a Vec.
many0_count
Repeats the embedded parser, counting the results
many1
Runs the embedded parser, gathering the results in a Vec.
map
Maps a function on the result of a parser.
map_res
Applies a function returning a Result over the result of a parser.
one_of
Recognizes one of the provided characters.
opt
Optional parser, will return None on Err::Error.
pair
Gets an object from the first parser, then gets another object from the second parser.
read_variable_length_integer
Decode the value of a variable length integer. https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer
recognize
If the child parser was successful, return the consumed input as produced value.
separated_list0
Alternates between two parsers to produce a list of elements.
separated_list1
Alternates between two parsers to produce a list of elements until Err::Error.
tag
Recognizes a pattern
take
Returns an input slice containing the first N input elements (Input[..N]).
terminated
Gets an object from the first parser, then matches an object from the second parser and discards it.
variable_length_integer
Returns the variable length integer of the given value. https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer

Type Aliases§

I8
I16
I32
I64
I128
IoResult
A specialized Result type for I/O operations.
Keccak224
The Keccak-224 hash function.
Keccak256
The Keccak-256 hash function.
Keccak384
The Keccak-384 hash function.
Keccak512
The Keccak-512 hash function.
ParserResult
The nom-compatible parser return type.
Pedersen64
Pedersen64 is an additively-homomorphic collision-resistant hash function that takes up to a 64-bit input.
Pedersen128
Pedersen128 is an additively-homomorphic collision-resistant hash function that takes up to a 128-bit input.
Poseidon2
Poseidon2 is a cryptographic hash function of input rate 2.
Poseidon4
Poseidon4 is a cryptographic hash function of input rate 4.
Poseidon8
Poseidon8 is a cryptographic hash function of input rate 8.
Result
Result<T, Error>
Sha3_224
The SHA3-224 hash function.
Sha3_256
The SHA3-256 hash function.
Sha3_384
The SHA3-384 hash function.
Sha3_512
The SHA3-512 hash function.
U8
U16
U32
U64
U128

Derive Macros§

Debug
Derive macro generating an impl of the trait Debug.
Deserialize
Serialize
_
Derive macro generating an impl of the trait Hash.