pub struct MagicCrypt { /* private fields */ }Expand description
This struct can help you encrypt or decrypt data in a quick way.
Implementations§
Trait Implementations§
Source§impl Clone for MagicCrypt
impl Clone for MagicCrypt
Source§impl Debug for MagicCrypt
impl Debug for MagicCrypt
Source§impl MagicCryptTrait for MagicCrypt
impl MagicCryptTrait for MagicCrypt
fn new<S: AsRef<[u8]>, V: AsRef<[u8]>>(key: S, iv: Option<V>) -> MagicCrypt
fn encrypt_to_bytes<T: ?Sized + AsRef<[u8]>>(&self, data: &T) -> Vec<u8> ⓘ
Source§fn encrypt_reader_to_bytes(
&self,
reader: &mut dyn Read,
) -> Result<Vec<u8>, MagicCryptError>
fn encrypt_reader_to_bytes( &self, reader: &mut dyn Read, ) -> Result<Vec<u8>, MagicCryptError>
Read all input into memory and return its encrypted bytes.
Source§fn encrypt_reader_to_writer2<N: ArraySize + PartialDiv<U16> + IsGreaterOrEqual<U16, Output = True>>(
&self,
reader: &mut dyn Read,
writer: &mut dyn Write,
) -> Result<(), MagicCryptError>
fn encrypt_reader_to_writer2<N: ArraySize + PartialDiv<U16> + IsGreaterOrEqual<U16, Output = True>>( &self, reader: &mut dyn Read, writer: &mut dyn Write, ) -> Result<(), MagicCryptError>
Encrypt data in chunks with a buffer of
N bytes and flush the writer on success. Read morefn decrypt_bytes_to_bytes<T: ?Sized + AsRef<[u8]>>( &self, bytes: &T, ) -> Result<Vec<u8>, MagicCryptError>
Source§fn decrypt_reader_to_bytes(
&self,
reader: &mut dyn Read,
) -> Result<Vec<u8>, MagicCryptError>
fn decrypt_reader_to_bytes( &self, reader: &mut dyn Read, ) -> Result<Vec<u8>, MagicCryptError>
Read all input into memory and return its decrypted bytes.
Source§fn decrypt_reader_to_writer2<N: ArraySize + PartialDiv<U16> + IsGreaterOrEqual<U16, Output = True>>(
&self,
reader: &mut dyn Read,
writer: &mut dyn Write,
) -> Result<(), MagicCryptError>
fn decrypt_reader_to_writer2<N: ArraySize + PartialDiv<U16> + IsGreaterOrEqual<U16, Output = True>>( &self, reader: &mut dyn Read, writer: &mut dyn Write, ) -> Result<(), MagicCryptError>
Decrypt data in chunks with a buffer of
N bytes and flush the writer on success. Read morefn encrypt_str_to_base64<S: AsRef<str>>(&self, string: S) -> String
fn encrypt_str_to_bytes<S: AsRef<str>>(&self, string: S) -> Vec<u8> ⓘ
fn encrypt_bytes_to_base64<T: ?Sized + AsRef<[u8]>>(&self, bytes: &T) -> String
fn encrypt_bytes_to_bytes<T: ?Sized + AsRef<[u8]>>(&self, bytes: &T) -> Vec<u8> ⓘ
fn encrypt_to_base64<T: ?Sized + AsRef<[u8]>>(&self, data: &T) -> String
Source§fn encrypt_reader_to_base64(
&self,
reader: &mut dyn Read,
) -> Result<String, MagicCryptError>
fn encrypt_reader_to_base64( &self, reader: &mut dyn Read, ) -> Result<String, MagicCryptError>
Read all input into memory and return its encrypted data as Base64.
Source§fn encrypt_reader_to_writer(
&self,
reader: &mut dyn Read,
writer: &mut dyn Write,
) -> Result<(), MagicCryptError>
fn encrypt_reader_to_writer( &self, reader: &mut dyn Read, writer: &mut dyn Write, ) -> Result<(), MagicCryptError>
Encrypt data in chunks with a 4096-byte buffer and flush the writer on success. Read more
fn decrypt_base64_to_string<S: AsRef<str>>( &self, base64: S, ) -> Result<String, MagicCryptError>
fn decrypt_base64_to_bytes<S: AsRef<str>>( &self, base64: S, ) -> Result<Vec<u8>, MagicCryptError>
Source§fn decrypt_reader_to_writer(
&self,
reader: &mut dyn Read,
writer: &mut dyn Write,
) -> Result<(), MagicCryptError>
fn decrypt_reader_to_writer( &self, reader: &mut dyn Read, writer: &mut dyn Write, ) -> Result<(), MagicCryptError>
Decrypt data in chunks with a 4096-byte buffer and flush the writer on success. Read more
Auto Trait Implementations§
impl Freeze for MagicCrypt
impl RefUnwindSafe for MagicCrypt
impl Send for MagicCrypt
impl Sync for MagicCrypt
impl Unpin for MagicCrypt
impl UnsafeUnpin for MagicCrypt
impl UnwindSafe for MagicCrypt
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