codebreaker

Crates.iocodebreaker
lib.rscodebreaker
version0.3.2
sourcesrc
created_at2020-05-08 18:38:58.847222
updated_at2024-03-06 11:40:59.691978
descriptionDecrypt & encrypt any cheat code for CodeBreaker PS2
homepagehttps://crates.io/crates/codebreaker
repositoryhttps://github.com/mlafeldt/codebreaker-rs
max_upload_size
id238982
size66,370
Mathias Lafeldt (mlafeldt)

documentation

https://docs.rs/codebreaker/

README

codebreaker-rs

Latest version Documentation CI

A Rust library to decrypt & encrypt any cheat code for CodeBreaker PS2.

Originally reverse-engineered from MIPS R5900 assembly and converted to C in 2006. Now ported to Rust for fun and profit.

For more information, check out my article on 7 Things I Learned From Porting a C Crypto Library to Rust.

Quickstart

Add the crate as a dependency to your Cargo.toml:

[dependencies]
codebreaker = "0.3"

Now you can start decrypting some codes:

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!(cb.auto_decrypt_code(code.0, code.1), output[i]);
}

Read the full documentation for more examples.

no_std support

The codebreaker crate has a Cargo feature named "std" that is enabled by default. In order to use the crate on embedded systems, this feature needs to be disabled:

[dependencies]
codebreaker = { version = "0.3", default-features = false }

License

Copyright (c) 2020-2024 Mathias Lafeldt

Licensed under the Apache License, Version 2.0 or the MIT license, at your option.

Commit count: 113

cargo fmt