libpso/src/crypto/mod.rs

30 lines
528 B
Rust
Raw Normal View History

2019-06-23 15:52:09 -07:00
pub mod pc;
2019-06-08 18:06:10 -07:00
#[derive(Debug)]
pub enum CipherError {
InvalidSize
}
2019-06-23 15:52:09 -07:00
pub trait PSOCipher {
2019-06-08 18:06:10 -07:00
fn encrypt(&mut self, data: &Vec<u8>) -> Result<Vec<u8>, CipherError>;
fn decrypt(&mut self, data: &Vec<u8>) -> Result<Vec<u8>, CipherError>;
}
2019-06-23 15:52:09 -07:00
pub struct NullCipher {
}
impl PSOCipher for NullCipher {
fn encrypt(&mut self, data: &Vec<u8>) -> Result<Vec<u8>, CipherError> {
Ok(data.clone())
}
fn decrypt(&mut self, data: &Vec<u8>) -> Result<Vec<u8>, CipherError> {
Ok(data.clone())
}
}