use crate::ir::DataType;
use crate::ops::Backend;
use crate::ops::{IntrinsicDescriptor, OpSpec};
pub const WGSL: &str = concat!(
include_str!("wgsl_shaders/words.wgsl"),
"\n",
include_str!("wgsl_shaders/sha1.wgsl"),
);
pub const INPUTS: &[DataType] = &[DataType::Bytes];
pub const LAWS: &[crate::ops::AlgebraicLaw] = &[];
pub const OUTPUTS: &[DataType] = &[const { DataType::U32 }; 5];
#[must_use]
pub fn sha1(input: &[u8]) -> [u32; 5] {
crate::ops::hash::reference::sha1::sha1_words(input)
}
pub const SPEC: OpSpec = OpSpec::intrinsic(
"hash.sha1",
INPUTS,
OUTPUTS,
LAWS,
wgsl_only,
IntrinsicDescriptor::new(
"hash.sha1.wgsl",
"wgsl-sha1-compress",
crate::ops::hash::cpu_refs::sha1,
),
);
pub fn wgsl_only(backend: &Backend) -> bool {
matches!(backend, Backend::Wgsl)
}