pub trait Aleo: Environment {
const MAX_DATA_SIZE_IN_FIELDS: u32 = <Self::Network as console::Network>::MAX_DATA_SIZE_IN_FIELDS;
Show 49 methods
// Required methods
fn initialize_global_constants();
fn encryption_domain() -> Field<Self>;
fn graph_key_domain() -> Field<Self>;
fn serial_number_domain() -> Field<Self>;
fn g_scalar_multiply(scalar: &Scalar<Self>) -> Group<Self>;
fn commit_bhp256(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Field<Self>;
fn commit_bhp512(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Field<Self>;
fn commit_bhp768(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Field<Self>;
fn commit_bhp1024(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Field<Self>;
fn commit_ped64(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Field<Self>;
fn commit_ped128(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Field<Self>;
fn commit_to_group_bhp256(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Group<Self>;
fn commit_to_group_bhp512(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Group<Self>;
fn commit_to_group_bhp768(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Group<Self>;
fn commit_to_group_bhp1024(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Group<Self>;
fn commit_to_group_ped64(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Group<Self>;
fn commit_to_group_ped128(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Group<Self>;
fn hash_bhp256(input: &[Boolean<Self>]) -> Field<Self>;
fn hash_bhp512(input: &[Boolean<Self>]) -> Field<Self>;
fn hash_bhp768(input: &[Boolean<Self>]) -> Field<Self>;
fn hash_bhp1024(input: &[Boolean<Self>]) -> Field<Self>;
fn hash_keccak256(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>;
fn hash_keccak384(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>;
fn hash_keccak512(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>;
fn hash_ped64(input: &[Boolean<Self>]) -> Field<Self>;
fn hash_ped128(input: &[Boolean<Self>]) -> Field<Self>;
fn hash_psd2(input: &[Field<Self>]) -> Field<Self>;
fn hash_psd4(input: &[Field<Self>]) -> Field<Self>;
fn hash_psd8(input: &[Field<Self>]) -> Field<Self>;
fn hash_sha3_256(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>;
fn hash_sha3_384(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>;
fn hash_sha3_512(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>;
fn hash_many_psd2(
input: &[Field<Self>],
num_outputs: u16,
) -> Vec<Field<Self>>;
fn hash_many_psd4(
input: &[Field<Self>],
num_outputs: u16,
) -> Vec<Field<Self>>;
fn hash_many_psd8(
input: &[Field<Self>],
num_outputs: u16,
) -> Vec<Field<Self>>;
fn hash_to_group_bhp256(input: &[Boolean<Self>]) -> Group<Self>;
fn hash_to_group_bhp512(input: &[Boolean<Self>]) -> Group<Self>;
fn hash_to_group_bhp768(input: &[Boolean<Self>]) -> Group<Self>;
fn hash_to_group_bhp1024(input: &[Boolean<Self>]) -> Group<Self>;
fn hash_to_group_ped64(input: &[Boolean<Self>]) -> Group<Self>;
fn hash_to_group_ped128(input: &[Boolean<Self>]) -> Group<Self>;
fn hash_to_group_psd2(input: &[Field<Self>]) -> Group<Self>;
fn hash_to_group_psd4(input: &[Field<Self>]) -> Group<Self>;
fn hash_to_group_psd8(input: &[Field<Self>]) -> Group<Self>;
fn hash_to_scalar_psd2(input: &[Field<Self>]) -> Scalar<Self>;
fn hash_to_scalar_psd4(input: &[Field<Self>]) -> Scalar<Self>;
fn hash_to_scalar_psd8(input: &[Field<Self>]) -> Scalar<Self>;
fn verify_merkle_path_bhp<const DEPTH: u8>(
path: &MerklePath<Self, DEPTH>,
root: &Field<Self>,
leaf: &Vec<Boolean<Self>>,
) -> Boolean<Self>;
fn verify_merkle_path_psd<const DEPTH: u8>(
path: &MerklePath<Self, DEPTH>,
root: &Field<Self>,
leaf: &Vec<Field<Self>>,
) -> Boolean<Self>;
}
Expand description
Attention: Do not use Send + Sync
on this trait, as it is not thread-safe.
Provided Associated Constants§
Sourceconst MAX_DATA_SIZE_IN_FIELDS: u32 = <Self::Network as console::Network>::MAX_DATA_SIZE_IN_FIELDS
const MAX_DATA_SIZE_IN_FIELDS: u32 = <Self::Network as console::Network>::MAX_DATA_SIZE_IN_FIELDS
The maximum number of field elements in data (must not exceed u16::MAX).
Required Methods§
Sourcefn initialize_global_constants()
fn initialize_global_constants()
Initializes the global constants for the Aleo environment.
Sourcefn encryption_domain() -> Field<Self>
fn encryption_domain() -> Field<Self>
Returns the encryption domain as a constant field element.
Sourcefn graph_key_domain() -> Field<Self>
fn graph_key_domain() -> Field<Self>
Returns the graph key domain as a constant field element.
Sourcefn serial_number_domain() -> Field<Self>
fn serial_number_domain() -> Field<Self>
Returns the serial number domain as a constant field element.
Sourcefn g_scalar_multiply(scalar: &Scalar<Self>) -> Group<Self>
fn g_scalar_multiply(scalar: &Scalar<Self>) -> Group<Self>
Returns the scalar multiplication on the generator G
.
Sourcefn commit_bhp256(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Field<Self>
fn commit_bhp256( input: &[Boolean<Self>], randomizer: &Scalar<Self>, ) -> Field<Self>
Returns a BHP commitment with an input hasher of 256-bits.
Sourcefn commit_bhp512(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Field<Self>
fn commit_bhp512( input: &[Boolean<Self>], randomizer: &Scalar<Self>, ) -> Field<Self>
Returns a BHP commitment with an input hasher of 512-bits.
Sourcefn commit_bhp768(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Field<Self>
fn commit_bhp768( input: &[Boolean<Self>], randomizer: &Scalar<Self>, ) -> Field<Self>
Returns a BHP commitment with an input hasher of 768-bits.
Sourcefn commit_bhp1024(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Field<Self>
fn commit_bhp1024( input: &[Boolean<Self>], randomizer: &Scalar<Self>, ) -> Field<Self>
Returns a BHP commitment with an input hasher of 1024-bits.
Sourcefn commit_ped64(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Field<Self>
fn commit_ped64( input: &[Boolean<Self>], randomizer: &Scalar<Self>, ) -> Field<Self>
Returns a Pedersen commitment for the given (up to) 64-bit input and randomizer.
Sourcefn commit_ped128(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Field<Self>
fn commit_ped128( input: &[Boolean<Self>], randomizer: &Scalar<Self>, ) -> Field<Self>
Returns a Pedersen commitment for the given (up to) 128-bit input and randomizer.
Sourcefn commit_to_group_bhp256(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Group<Self>
fn commit_to_group_bhp256( input: &[Boolean<Self>], randomizer: &Scalar<Self>, ) -> Group<Self>
Returns a BHP commitment with an input hasher of 256-bits.
Sourcefn commit_to_group_bhp512(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Group<Self>
fn commit_to_group_bhp512( input: &[Boolean<Self>], randomizer: &Scalar<Self>, ) -> Group<Self>
Returns a BHP commitment with an input hasher of 512-bits.
Sourcefn commit_to_group_bhp768(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Group<Self>
fn commit_to_group_bhp768( input: &[Boolean<Self>], randomizer: &Scalar<Self>, ) -> Group<Self>
Returns a BHP commitment with an input hasher of 768-bits.
Sourcefn commit_to_group_bhp1024(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Group<Self>
fn commit_to_group_bhp1024( input: &[Boolean<Self>], randomizer: &Scalar<Self>, ) -> Group<Self>
Returns a BHP commitment with an input hasher of 1024-bits.
Sourcefn commit_to_group_ped64(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Group<Self>
fn commit_to_group_ped64( input: &[Boolean<Self>], randomizer: &Scalar<Self>, ) -> Group<Self>
Returns a Pedersen commitment for the given (up to) 64-bit input and randomizer.
Sourcefn commit_to_group_ped128(
input: &[Boolean<Self>],
randomizer: &Scalar<Self>,
) -> Group<Self>
fn commit_to_group_ped128( input: &[Boolean<Self>], randomizer: &Scalar<Self>, ) -> Group<Self>
Returns a Pedersen commitment for the given (up to) 128-bit input and randomizer.
Sourcefn hash_bhp256(input: &[Boolean<Self>]) -> Field<Self>
fn hash_bhp256(input: &[Boolean<Self>]) -> Field<Self>
Returns the BHP hash with an input hasher of 256-bits.
Sourcefn hash_bhp512(input: &[Boolean<Self>]) -> Field<Self>
fn hash_bhp512(input: &[Boolean<Self>]) -> Field<Self>
Returns the BHP hash with an input hasher of 512-bits.
Sourcefn hash_bhp768(input: &[Boolean<Self>]) -> Field<Self>
fn hash_bhp768(input: &[Boolean<Self>]) -> Field<Self>
Returns the BHP hash with an input hasher of 768-bits.
Sourcefn hash_bhp1024(input: &[Boolean<Self>]) -> Field<Self>
fn hash_bhp1024(input: &[Boolean<Self>]) -> Field<Self>
Returns the BHP hash with an input hasher of 1024-bits.
Sourcefn hash_keccak256(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>
fn hash_keccak256(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>
Returns the Keccak hash with a 256-bit output.
Sourcefn hash_keccak384(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>
fn hash_keccak384(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>
Returns the Keccak hash with a 384-bit output.
Sourcefn hash_keccak512(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>
fn hash_keccak512(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>
Returns the Keccak hash with a 512-bit output.
Sourcefn hash_ped64(input: &[Boolean<Self>]) -> Field<Self>
fn hash_ped64(input: &[Boolean<Self>]) -> Field<Self>
Returns the Pedersen hash for a given (up to) 64-bit input.
Sourcefn hash_ped128(input: &[Boolean<Self>]) -> Field<Self>
fn hash_ped128(input: &[Boolean<Self>]) -> Field<Self>
Returns the Pedersen hash for a given (up to) 128-bit input.
Sourcefn hash_psd2(input: &[Field<Self>]) -> Field<Self>
fn hash_psd2(input: &[Field<Self>]) -> Field<Self>
Returns the Poseidon hash with an input rate of 2.
Sourcefn hash_psd4(input: &[Field<Self>]) -> Field<Self>
fn hash_psd4(input: &[Field<Self>]) -> Field<Self>
Returns the Poseidon hash with an input rate of 4.
Sourcefn hash_psd8(input: &[Field<Self>]) -> Field<Self>
fn hash_psd8(input: &[Field<Self>]) -> Field<Self>
Returns the Poseidon hash with an input rate of 8.
Sourcefn hash_sha3_256(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>
fn hash_sha3_256(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>
Returns the SHA-3 hash with a 256-bit output.
Sourcefn hash_sha3_384(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>
fn hash_sha3_384(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>
Returns the SHA-3 hash with a 384-bit output.
Sourcefn hash_sha3_512(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>
fn hash_sha3_512(input: &[Boolean<Self>]) -> Vec<Boolean<Self>>
Returns the SHA-3 hash with a 512-bit output.
Sourcefn hash_many_psd2(input: &[Field<Self>], num_outputs: u16) -> Vec<Field<Self>>
fn hash_many_psd2(input: &[Field<Self>], num_outputs: u16) -> Vec<Field<Self>>
Returns the extended Poseidon hash with an input rate of 2.
Sourcefn hash_many_psd4(input: &[Field<Self>], num_outputs: u16) -> Vec<Field<Self>>
fn hash_many_psd4(input: &[Field<Self>], num_outputs: u16) -> Vec<Field<Self>>
Returns the extended Poseidon hash with an input rate of 4.
Sourcefn hash_many_psd8(input: &[Field<Self>], num_outputs: u16) -> Vec<Field<Self>>
fn hash_many_psd8(input: &[Field<Self>], num_outputs: u16) -> Vec<Field<Self>>
Returns the extended Poseidon hash with an input rate of 8.
Sourcefn hash_to_group_bhp256(input: &[Boolean<Self>]) -> Group<Self>
fn hash_to_group_bhp256(input: &[Boolean<Self>]) -> Group<Self>
Returns the BHP hash with an input hasher of 256-bits.
Sourcefn hash_to_group_bhp512(input: &[Boolean<Self>]) -> Group<Self>
fn hash_to_group_bhp512(input: &[Boolean<Self>]) -> Group<Self>
Returns the BHP hash with an input hasher of 512-bits.
Sourcefn hash_to_group_bhp768(input: &[Boolean<Self>]) -> Group<Self>
fn hash_to_group_bhp768(input: &[Boolean<Self>]) -> Group<Self>
Returns the BHP hash with an input hasher of 768-bits.
Sourcefn hash_to_group_bhp1024(input: &[Boolean<Self>]) -> Group<Self>
fn hash_to_group_bhp1024(input: &[Boolean<Self>]) -> Group<Self>
Returns the BHP hash with an input hasher of 1024-bits.
Sourcefn hash_to_group_ped64(input: &[Boolean<Self>]) -> Group<Self>
fn hash_to_group_ped64(input: &[Boolean<Self>]) -> Group<Self>
Returns the Pedersen hash for a given (up to) 64-bit input.
Sourcefn hash_to_group_ped128(input: &[Boolean<Self>]) -> Group<Self>
fn hash_to_group_ped128(input: &[Boolean<Self>]) -> Group<Self>
Returns the Pedersen hash for a given (up to) 128-bit input.
Sourcefn hash_to_group_psd2(input: &[Field<Self>]) -> Group<Self>
fn hash_to_group_psd2(input: &[Field<Self>]) -> Group<Self>
Returns the Poseidon hash with an input rate of 2 on the affine curve.
Sourcefn hash_to_group_psd4(input: &[Field<Self>]) -> Group<Self>
fn hash_to_group_psd4(input: &[Field<Self>]) -> Group<Self>
Returns the Poseidon hash with an input rate of 4 on the affine curve.
Sourcefn hash_to_group_psd8(input: &[Field<Self>]) -> Group<Self>
fn hash_to_group_psd8(input: &[Field<Self>]) -> Group<Self>
Returns the Poseidon hash with an input rate of 8 on the affine curve.
Sourcefn hash_to_scalar_psd2(input: &[Field<Self>]) -> Scalar<Self>
fn hash_to_scalar_psd2(input: &[Field<Self>]) -> Scalar<Self>
Returns the Poseidon hash with an input rate of 2 on the scalar field.
Sourcefn hash_to_scalar_psd4(input: &[Field<Self>]) -> Scalar<Self>
fn hash_to_scalar_psd4(input: &[Field<Self>]) -> Scalar<Self>
Returns the Poseidon hash with an input rate of 4 on the scalar field.
Sourcefn hash_to_scalar_psd8(input: &[Field<Self>]) -> Scalar<Self>
fn hash_to_scalar_psd8(input: &[Field<Self>]) -> Scalar<Self>
Returns the Poseidon hash with an input rate of 8 on the scalar field.
Sourcefn verify_merkle_path_bhp<const DEPTH: u8>(
path: &MerklePath<Self, DEPTH>,
root: &Field<Self>,
leaf: &Vec<Boolean<Self>>,
) -> Boolean<Self>
fn verify_merkle_path_bhp<const DEPTH: u8>( path: &MerklePath<Self, DEPTH>, root: &Field<Self>, leaf: &Vec<Boolean<Self>>, ) -> Boolean<Self>
Returns true
if the given Merkle path is valid for the given root and leaf.
Sourcefn verify_merkle_path_psd<const DEPTH: u8>(
path: &MerklePath<Self, DEPTH>,
root: &Field<Self>,
leaf: &Vec<Field<Self>>,
) -> Boolean<Self>
fn verify_merkle_path_psd<const DEPTH: u8>( path: &MerklePath<Self, DEPTH>, root: &Field<Self>, leaf: &Vec<Field<Self>>, ) -> Boolean<Self>
Returns true
if the given Merkle path is valid for the given root and leaf.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.