[−][src]Struct codebreaker::Codebreaker
A processor for CB v1 and v7 codes.
Implementations
impl Codebreaker
[src]
pub const fn new() -> Self
[src]
Returns a new processor for encrypting and decrypting a list of CB v1 and v7 codes.
pub fn new_v7() -> Self
[src]
Returns a new processor for all CB v7 codes published on CMGSCCC.com.
Lets you omit B4336FA9 4DFEFB79
as the first code in the list.
pub fn encrypt_code(&mut self, addr: u32, val: u32) -> (u32, u32)
[src]
Encrypts a code and returns the result.
Example
use codebreaker::Codebreaker; let mut cb = Codebreaker::new(); let code = cb.encrypt_code(0x2043AFCC, 0x2411FFFF); assert_eq!((0x2AFF014C, 0x2411FFFF), code);
pub fn encrypt_code_mut(&mut self, addr: &mut u32, val: &mut u32)
[src]
Encrypts a code directly.
Example
use codebreaker::Codebreaker; let mut cb = Codebreaker::new(); let mut code = (0x2043AFCC, 0x2411FFFF); cb.encrypt_code_mut(&mut code.0, &mut code.1); assert_eq!((0x2AFF014C, 0x2411FFFF), code);
pub fn decrypt_code(&mut self, addr: u32, val: u32) -> (u32, u32)
[src]
Decrypts a code and returns the result.
Example
use codebreaker::Codebreaker; let encrypted: Vec<(u32, u32)> = vec![ (0x2AFF014C, 0x2411FFFF), (0xB4336FA9, 0x4DFEFB79), (0x973E0B2A, 0xA7D4AF10), ]; let decrypted: Vec<(u32, u32)> = vec![ (0x2043AFCC, 0x2411FFFF), (0xBEEFC0DE, 0x00000000), (0x2096F5B8, 0x000000BE), ]; let mut cb = Codebreaker::new(); for (i, code) in encrypted.iter().enumerate() { let result = cb.decrypt_code(code.0, code.1); assert_eq!(decrypted[i], result); }
pub fn decrypt_code_mut(&mut self, addr: &mut u32, val: &mut u32)
[src]
Decrypts a code directly.
Example
use codebreaker::Codebreaker; let mut encrypted: Vec<(u32, u32)> = vec![ (0x2AFF014C, 0x2411FFFF), (0xB4336FA9, 0x4DFEFB79), (0x973E0B2A, 0xA7D4AF10), ]; let decrypted: Vec<(u32, u32)> = vec![ (0x2043AFCC, 0x2411FFFF), (0xBEEFC0DE, 0x00000000), (0x2096F5B8, 0x000000BE), ]; let mut cb = Codebreaker::new(); for code in encrypted.iter_mut() { cb.decrypt_code_mut(&mut code.0, &mut code.1); } assert_eq!(decrypted, encrypted);
pub fn auto_decrypt_code(&mut self, addr: u32, val: u32) -> (u32, u32)
[src]
Smart version of decrypt_code
that detects if
and how a code needs to be decrypted.
Example
use codebreaker::Codebreaker; let input: Vec<(u32, u32)> = vec![ (0x2043AFCC, 0x2411FFFF), (0x2A973DBD, 0x00000000), (0xB4336FA9, 0x4DFEFB79), (0x973E0B2A, 0xA7D4AF10), ]; let output: Vec<(u32, u32)> = vec![ (0x2043AFCC, 0x2411FFFF), (0x201F6024, 0x00000000), (0xBEEFC0DE, 0x00000000), (0x2096F5B8, 0x000000BE), ]; let mut cb = Codebreaker::new(); for (i, code) in input.iter().enumerate() { assert_eq!(output[i], cb.auto_decrypt_code(code.0, code.1)); }
pub fn auto_decrypt_code_mut(&mut self, addr: &mut u32, val: &mut u32)
[src]
Smart version of decrypt_code_mut
that
detects if and how a code needs to be decrypted.
Trait Implementations
impl Clone for Codebreaker
[src]
fn clone(&self) -> Codebreaker
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for Codebreaker
[src]
impl Debug for Codebreaker
[src]
impl Default for Codebreaker
[src]
Does the same as new
.
Auto Trait Implementations
impl RefUnwindSafe for Codebreaker
impl Send for Codebreaker
impl Sync for Codebreaker
impl Unpin for Codebreaker
impl UnwindSafe for Codebreaker
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,