1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! CMAC-AES-128 message authentication code for WASI (WebAssembly System Interface).
//!
//! Provides message authentication using AES-128 as a MAC (Cipher-based Message Authentication Code).
//!
//! ## Example
//! ```rust
//! use aes_wasm::cmac_aes128::{mac, Key};
//! let key = Key::default();
//! let msg = b"hello";
//! let tag = mac(msg, &key);
//! ```
pub use crate::*;
/// The length of the key in bytes.
///
/// This constant is used for key array sizing.
pub const KEY_LEN: usize = 16;
/// The length of the authentication tag in bytes.
///
/// This constant is used for tag array sizing.
pub const TAG_LEN: usize = 16;
/// Key type for CMAC-AES128 (16 bytes).
pub type Key = ;
/// Tag type for CMAC-AES128 (16 bytes).
pub type Tag = ;
/// Computes the CMAC (Cipher-based Message Authentication Code) for a message using AES-128.
///
/// # Arguments
/// * `msg` - The message to authenticate.
/// * `key` - Reference to the secret key.
///
/// # Returns
/// Authentication tag as a 16-byte array.
///
/// # Example
/// ```
/// use aes_wasm::cmac_aes128::{mac, Key};
/// let key = Key::default();
/// let msg = b"hello";
/// let tag = mac(msg, &key);
/// ```