pub struct IpcryptNdx { /* private fields */ }Expand description
A structure representing the IPCrypt context for non-deterministic XTS mode encryption.
This struct provides methods for encrypting and decrypting IP addresses using AES-XTS mode with a 16-byte tweak. The key is 32 bytes (two AES-128 keys).
Implementations§
Source§impl IpcryptNdx
impl IpcryptNdx
Sourcepub const KEY_BYTES: usize = 32usize
pub const KEY_BYTES: usize = 32usize
The number of bytes required for the encryption key (two AES-128 keys).
Sourcepub const TWEAK_BYTES: usize = 16usize
pub const TWEAK_BYTES: usize = 16usize
The number of bytes required for the tweak.
Sourcepub const NDIP_BYTES: usize = 32usize
pub const NDIP_BYTES: usize = 32usize
The number of bytes of the encrypted IP address.
Sourcepub fn generate_key() -> [u8; 32]
pub fn generate_key() -> [u8; 32]
Generates a new random key for encryption.
Sourcepub fn new(key: [u8; 32]) -> Self
pub fn new(key: [u8; 32]) -> Self
Creates a new IpcryptNdx instance with the given key.
§Arguments
key- A 32-byte array containing two AES-128 keys.
Sourcepub fn new_random() -> Self
pub fn new_random() -> Self
Creates a new IpcryptNdx instance with a random key.
Sourcepub fn generate_tweak() -> [u8; 16]
pub fn generate_tweak() -> [u8; 16]
Generates a random tweak.
Auto Trait Implementations§
impl Freeze for IpcryptNdx
impl RefUnwindSafe for IpcryptNdx
impl Send for IpcryptNdx
impl Sync for IpcryptNdx
impl Unpin for IpcryptNdx
impl UnwindSafe for IpcryptNdx
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