You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
689 B

pub mod pc;
pub mod bb;
#[derive(Debug)]
pub enum CipherError {
InvalidSize
}
pub trait PSOCipher {
fn encrypt(&mut self, data: &[u8]) -> Result<Vec<u8>, CipherError>;
fn decrypt(&mut self, data: &[u8]) -> Result<Vec<u8>, CipherError>;
fn header_size(&self) -> usize;
fn block_size(&self) -> usize {
self.header_size()
}
}
pub struct NullCipher {
}
impl PSOCipher for NullCipher {
fn encrypt(&mut self, data: &[u8]) -> Result<Vec<u8>, CipherError> {
Ok(data.to_vec())
}
fn decrypt(&mut self, data: &[u8]) -> Result<Vec<u8>, CipherError> {
Ok(data.to_vec())
}
fn header_size(&self) -> usize {
4
}
}