pub struct IpcryptNd { /* private fields */ }Expand description
A structure representing the IPCrypt context for non-deterministic mode.
This struct provides methods for encrypting and decrypting IP addresses using KIASU-BC mode with an 8-byte tweak. The key is 16 bytes (one AES-128 key).
Implementations§
Source§impl IpcryptNd
impl IpcryptNd
Sourcepub const TWEAK_BYTES: usize = 8usize
pub const TWEAK_BYTES: usize = 8usize
The number of bytes required for the tweak.
Sourcepub const NDIP_BYTES: usize = 24usize
pub const NDIP_BYTES: usize = 24usize
The number of bytes in the non-deterministic mode output (8-byte tweak + 16-byte ciphertext).
Sourcepub fn generate_key() -> [u8; 16]
pub fn generate_key() -> [u8; 16]
Generates a new random key for encryption.
Sourcepub fn new(key: [u8; 16]) -> Self
pub fn new(key: [u8; 16]) -> Self
Creates a new IpcryptNd instance with the given key.
§Arguments
key- A 16-byte array containing the encryption key.
Sourcepub fn new_random() -> Self
pub fn new_random() -> Self
Creates a new IpcryptNd instance with a random key.
Sourcepub fn generate_tweak() -> [u8; 8]
pub fn generate_tweak() -> [u8; 8]
Generates a random tweak.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IpcryptNd
impl RefUnwindSafe for IpcryptNd
impl Send for IpcryptNd
impl Sync for IpcryptNd
impl Unpin for IpcryptNd
impl UnwindSafe for IpcryptNd
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more