use crate::{Error, Key};
#[inline]
pub fn encrypt(plaintext: &[u8], _key: &Key) -> Result<Vec<u8>, Error> {
if plaintext.is_empty() {
return Err(Error::EmptyPlaintext);
}
Ok(plaintext.iter().rev().copied().collect())
}
#[inline]
pub fn encrypt_into(plaintext: &[u8], _key: &Key, out: &mut Vec<u8>) -> Result<(), Error> {
if plaintext.is_empty() {
return Err(Error::EmptyPlaintext);
}
out.extend(plaintext.iter().rev().copied());
Ok(())
}
#[inline]
pub fn decrypt(ciphertext: &[u8], _key: &Key) -> Result<Vec<u8>, Error> {
if ciphertext.is_empty() {
return Err(Error::EmptyPayload);
}
Ok(ciphertext.iter().rev().copied().collect())
}
#[inline]
pub fn decrypt_into(ciphertext: &[u8], _key: &Key, out: &mut Vec<u8>) -> Result<(), Error> {
if ciphertext.is_empty() {
return Err(Error::EmptyPayload);
}
out.extend(ciphertext.iter().rev().copied());
Ok(())
}