have cipher specify header size
Really it is more about mimimum cipher block size. Please enter the commit message for your changes. Lines starting
This commit is contained in:
parent
de87b2f89e
commit
222f3c38da
@ -11,6 +11,7 @@ pub enum CipherError {
|
||||
pub trait PSOCipher {
|
||||
fn encrypt(&mut self, data: &Vec<u8>) -> Result<Vec<u8>, CipherError>;
|
||||
fn decrypt(&mut self, data: &Vec<u8>) -> Result<Vec<u8>, CipherError>;
|
||||
fn header_size(&self) -> usize;
|
||||
}
|
||||
|
||||
|
||||
@ -26,4 +27,8 @@ impl PSOCipher for NullCipher {
|
||||
fn decrypt(&mut self, data: &Vec<u8>) -> Result<Vec<u8>, CipherError> {
|
||||
Ok(data.clone())
|
||||
}
|
||||
|
||||
fn header_size(&self) -> usize {
|
||||
4
|
||||
}
|
||||
}
|
||||
|
@ -111,6 +111,10 @@ impl PSOCipher for PSOPCCipher {
|
||||
fn decrypt(&mut self, data: &Vec<u8>) -> Result<Vec<u8>, CipherError> {
|
||||
self.encrypt(data)
|
||||
}
|
||||
|
||||
fn header_size(&self) -> usize {
|
||||
4
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user