pub struct TripleDes { /* private fields */ }Expand description
A Triple-DES (TDEA) cipher.
Implementations§
Source§impl TripleDes
impl TripleDes
Sourcepub fn new_3key(key: &[u8; 24]) -> Result<Self, DesKeyError>
pub fn new_3key(key: &[u8; 24]) -> Result<Self, DesKeyError>
Construct a 3TDEA instance from a 24-byte key K1 ∥ K2 ∥ K3.
§Panics
Panics if the internal fixed-size key splits fail, which would only happen if this constructor were changed inconsistently with its type.
Sourcepub fn new_3key_wiping(key: &mut [u8; 24]) -> Result<Self, DesKeyError>
pub fn new_3key_wiping(key: &mut [u8; 24]) -> Result<Self, DesKeyError>
Construct a 3TDEA instance and wipe the provided key buffer.
Sourcepub fn new_2key(key: &[u8; 16]) -> Result<Self, DesKeyError>
pub fn new_2key(key: &[u8; 16]) -> Result<Self, DesKeyError>
Construct a 2TDEA instance from a 16-byte key K1 ∥ K2 (K3 = K1).
§Panics
Panics if the internal fixed-size key splits fail, which would only happen if this constructor were changed inconsistently with its type.
Sourcepub fn new_2key_wiping(key: &mut [u8; 16]) -> Result<Self, DesKeyError>
pub fn new_2key_wiping(key: &mut [u8; 16]) -> Result<Self, DesKeyError>
Construct a 2TDEA instance and wipe the provided key buffer.
Sourcepub fn new_single_key(key: &[u8; 8]) -> Result<Self, DesKeyError>
pub fn new_single_key(key: &[u8; 8]) -> Result<Self, DesKeyError>
Construct from three 8-byte keys. K1=K2=K3 is valid (degenerates to single DES) and is used by the NIST CAVP “KEYs” tests.
Sourcepub fn new_single_key_unchecked(key: &[u8; 8]) -> Self
pub fn new_single_key_unchecked(key: &[u8; 8]) -> Self
Construct from one DES key used as K1 = K2 = K3 without weak-key checks.
Sourcepub fn new_single_key_wiping(key: &mut [u8; 8]) -> Result<Self, DesKeyError>
pub fn new_single_key_wiping(key: &mut [u8; 8]) -> Result<Self, DesKeyError>
Construct from one DES key used as K1 = K2 = K3 and wipe the buffer.