use crate::algorithms::CoreFunction;
use leo_ast::Type;
pub struct BHP256Hash;
impl CoreFunction for BHP256Hash {
const NUM_ARGS: usize = 1;
fn first_arg_is_allowed_type(type_: &Type) -> bool {
!matches!(type_, Type::Mapping(_) | Type::Tuple(_) | Type::Err | Type::Unit)
}
fn return_type() -> Type {
Type::Field
}
}
pub struct BHP256Commit;
impl CoreFunction for BHP256Commit {
const NUM_ARGS: usize = 2;
fn first_arg_is_allowed_type(type_: &Type) -> bool {
!matches!(type_, Type::Mapping(_) | Type::Tuple(_) | Type::Err | Type::Unit)
}
fn second_arg_is_allowed_type(type_: &Type) -> bool {
matches!(type_, Type::Scalar)
}
fn return_type() -> Type {
Type::Field
}
}
pub struct BHP512Hash;
impl CoreFunction for BHP512Hash {
const NUM_ARGS: usize = 1;
fn first_arg_is_allowed_type(type_: &Type) -> bool {
!matches!(type_, Type::Mapping(_) | Type::Tuple(_) | Type::Err | Type::Unit)
}
fn return_type() -> Type {
Type::Field
}
}
pub struct BHP512Commit;
impl CoreFunction for BHP512Commit {
const NUM_ARGS: usize = 2;
fn first_arg_is_allowed_type(type_: &Type) -> bool {
!matches!(type_, Type::Mapping(_) | Type::Tuple(_) | Type::Err | Type::Unit)
}
fn second_arg_is_allowed_type(type_: &Type) -> bool {
matches!(type_, Type::Scalar)
}
fn return_type() -> Type {
Type::Field
}
}
pub struct BHP768Hash;
impl CoreFunction for BHP768Hash {
const NUM_ARGS: usize = 1;
fn first_arg_is_allowed_type(type_: &Type) -> bool {
!matches!(type_, Type::Mapping(_) | Type::Tuple(_) | Type::Err | Type::Unit)
}
fn return_type() -> Type {
Type::Field
}
}
pub struct BHP768Commit;
impl CoreFunction for BHP768Commit {
const NUM_ARGS: usize = 2;
fn first_arg_is_allowed_type(type_: &Type) -> bool {
!matches!(type_, Type::Mapping(_) | Type::Tuple(_) | Type::Err | Type::Unit)
}
fn second_arg_is_allowed_type(type_: &Type) -> bool {
matches!(type_, Type::Scalar)
}
fn return_type() -> Type {
Type::Field
}
}
pub struct BHP1024Hash;
impl CoreFunction for BHP1024Hash {
const NUM_ARGS: usize = 1;
fn first_arg_is_allowed_type(type_: &Type) -> bool {
!matches!(type_, Type::Mapping(_) | Type::Tuple(_) | Type::Err | Type::Unit)
}
fn return_type() -> Type {
Type::Field
}
}
pub struct BHP1024Commit;
impl CoreFunction for BHP1024Commit {
const NUM_ARGS: usize = 2;
fn first_arg_is_allowed_type(type_: &Type) -> bool {
!matches!(type_, Type::Mapping(_) | Type::Tuple(_) | Type::Err | Type::Unit)
}
fn second_arg_is_allowed_type(type_: &Type) -> bool {
matches!(type_, Type::Scalar)
}
fn return_type() -> Type {
Type::Field
}
}