pub struct PRP { /* private fields */ }
Expand description
Implementation of Pseudo-Random Permutation (PRP). Currently based on the Lioness wide-block cipher.
Implementations§
Source§impl PRP
impl PRP
Sourcepub fn new(key: [u8; 128], iv: [u8; 64]) -> Self
pub fn new(key: [u8; 128], iv: [u8; 64]) -> Self
Creates new instance of the PRP using the raw key and IV.
Sourcepub fn from_parameters(params: PRPParameters) -> Self
pub fn from_parameters(params: PRPParameters) -> Self
Creates a new PRP instance using the given parameters
Source§impl PRP
impl PRP
Sourcepub fn forward(&self, plaintext: &[u8]) -> Result<Box<[u8]>>
pub fn forward(&self, plaintext: &[u8]) -> Result<Box<[u8]>>
Applies forward permutation on the given plaintext and returns a new buffer containing the result.
Sourcepub fn forward_inplace(&self, plaintext: &mut [u8]) -> Result<()>
pub fn forward_inplace(&self, plaintext: &mut [u8]) -> Result<()>
Applies forward permutation on the given plaintext and modifies the given buffer in-place.
Sourcepub fn inverse(&self, ciphertext: &[u8]) -> Result<Box<[u8]>>
pub fn inverse(&self, ciphertext: &[u8]) -> Result<Box<[u8]>>
Applies inverse permutation on the given plaintext and returns a new buffer containing the result.
Sourcepub fn inverse_inplace(&self, ciphertext: &mut [u8]) -> Result<()>
pub fn inverse_inplace(&self, ciphertext: &mut [u8]) -> Result<()>
Applies inverse permutation on the given ciphertext and modifies the given buffer in-place.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PRP
impl RefUnwindSafe for PRP
impl Send for PRP
impl Sync for PRP
impl Unpin for PRP
impl UnwindSafe for PRP
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