Struct common_crypto::cryptor::Cryptor [−][src]
A cryptor supporting all of the block and stream ciphers provided by the common crypto library.
let config = Config::RC4 { key: b"Key" }; assert_eq!( Cryptor::encrypt(&config, b"Plaintext").unwrap(), &[0xbb, 0xf3, 0x16, 0xe8, 0xd9, 0x40, 0xaf, 0x0a, 0xd3] );
Implementations
impl Cryptor[src]
pub fn new_encryptor<'a>(config: &Config<'a>) -> Result<Self, CryptorError>[src]
pub fn new_decryptor<'a>(config: &Config<'a>) -> Result<Self, CryptorError>[src]
pub fn update(
&self,
input: impl AsRef<[u8]>,
output: &mut Vec<u8>
) -> Result<(), CryptorError>[src]
&self,
input: impl AsRef<[u8]>,
output: &mut Vec<u8>
) -> Result<(), CryptorError>
Encrypts the data and writes to the provided buffer. The buffer will be resized as required, and will be cleared on error.
pub fn finish(self, output: &mut Vec<u8>) -> Result<(), CryptorError>[src]
Finalises the encryption, returning any remaining data where appropriate. The cryptor cannot be used again.
impl Cryptor[src]
pub fn encrypt<'a>(
config: &Config<'a>,
input: impl AsRef<[u8]>
) -> Result<Vec<u8>, CryptorError>[src]
config: &Config<'a>,
input: impl AsRef<[u8]>
) -> Result<Vec<u8>, CryptorError>
pub fn decrypt<'a>(
config: &Config<'a>,
input: impl AsRef<[u8]>
) -> Result<Vec<u8>, CryptorError>[src]
config: &Config<'a>,
input: impl AsRef<[u8]>
) -> Result<Vec<u8>, CryptorError>
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Cryptor[src]
impl !Send for Cryptor[src]
impl !Sync for Cryptor[src]
impl Unpin for Cryptor[src]
impl UnwindSafe for Cryptor[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,