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
71
72
73
74
75
76
77
78
79
80
81
//! # Scintia-96
//!
//! A lightweight, keyed 96-bit permutation based on the Speck cipher.
//!
//! Scintia-96 is designed for use cases where you need a one-to-one mapping of a 96-bit input
//! (such as a hardware unique ID) to a 96-bit output (such as a USB serial number),
//! ensuring that uniqueness is preserved without collisions.
//!
//!
//! ## Features
//!
//! - **`cipher`** (optional): Enables the RustCrypto cipher traits implementation for server environments.
//! This includes the `Scintia96Cipher` struct which precomputes the key schedule for efficiency
//! and enables **reversing (decrypting)** the permutation.
//!
//! ## Example
//!
//! ```rust
//! use scintia_96::Scintia96;
//!
//! // 128-bit key (4 x u32)
//! const KEY: [u32; 4] = [0x01020304, 0x05060708, 0x090a0b0c, 0x0d0e0f10];
//! const PERMUTATION: Scintia96 = Scintia96::new(KEY);
//!
//! fn main() {
//! // 96-bit block as raw bytes
//! let mut block = [0xde, 0xad, 0xbe, 0xef, 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xfe, 0xed];
//! PERMUTATION.permute_block(&mut block);
//! }
//! ```
//!
//! For more advanced usage or server-side environments, enable the `cipher` feature to use `Scintia96Cipher`.
pub
pub use Scintia96;
pub use Scintia96Cipher;
/// A trait for types that can perform the Scintia-96 96-bit keyed permutation.
///
/// Most users should use the inherent methods on [`Scintia96`] or [`Scintia96Cipher`]
/// instead of this trait directly.
/// A trait for types that can perform the inverse Scintia-96 96-bit keyed permutation.
///
/// Most users should use the inherent methods on [`Scintia96Cipher`] instead of this
/// trait directly.
pub const ROUNDS: u32 = 32;