2024-09-04 00:12:20 +00:00
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
pub mod v1;
|
2024-09-04 18:13:03 +00:00
|
|
|
pub mod v2_map;
|
2024-09-04 00:12:20 +00:00
|
|
|
pub mod v2_rc4;
|
|
|
|
|
|
|
|
#[derive(Error, Debug)]
|
2024-09-04 18:13:03 +00:00
|
|
|
pub enum QmcCryptoError {
|
|
|
|
#[error("QMC V2/Map Cipher: Key is empty")]
|
|
|
|
QMCV2MapKeyEmpty,
|
|
|
|
}
|
2024-09-04 21:24:34 +00:00
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod test {
|
|
|
|
pub fn generate_key(len: usize) -> Vec<u8> {
|
|
|
|
(1..=len).map(|i| i as u8).collect()
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
pub fn generate_key_128() -> [u8; 128] {
|
|
|
|
generate_key(128)
|
|
|
|
.try_into()
|
|
|
|
.expect("failed to make test key")
|
|
|
|
}
|
|
|
|
}
|