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"),
);
#[must_use]
pub fn hmac_sha1(key: &[u8], msg: &[u8]) -> [u32; 5] {
crate::ops::hash::reference::hmac::hmac_sha1_words(key, msg)
}
pub const INPUTS: &[DataType] = &[DataType::Bytes, DataType::Bytes];
pub const LAWS: &[crate::ops::AlgebraicLaw] = &[];
pub const OUTPUTS: &[DataType] = &[const { DataType::U32 }; 5];
pub const SPEC: OpSpec = OpSpec::intrinsic(
"hash.hmac_sha1",
INPUTS,
OUTPUTS,
LAWS,
wgsl_only,
IntrinsicDescriptor::new(
"hash.hmac_sha1.wgsl",
"wgsl-hmac-sha1",
crate::ops::hash::cpu_refs::hmac_sha1,
),
);
pub fn wgsl_only(backend: &Backend) -> bool {
matches!(backend, Backend::Wgsl)
}