#ps2 #gamehacking #homebrew #codebreaker

no-std codebreaker

Decrypt & encrypt any cheat code for CodeBreaker PS2

16 releases

0.3.1 Sep 10, 2022
0.3.0 Dec 24, 2021
0.2.6 Nov 6, 2021
0.2.3 Apr 7, 2021
0.2.2 Jul 3, 2020

#48 in Games

Download history 3/week @ 2022-11-24 8/week @ 2022-12-01 23/week @ 2022-12-08 8/week @ 2022-12-15 29/week @ 2022-12-22 12/week @ 2022-12-29 9/week @ 2023-01-05 5/week @ 2023-01-12 21/week @ 2023-01-19 17/week @ 2023-01-26 22/week @ 2023-02-02 48/week @ 2023-02-09 63/week @ 2023-02-16 6/week @ 2023-02-23 9/week @ 2023-03-02 12/week @ 2023-03-09

98 downloads per month
Used in 2 crates

MIT/Apache

53KB
1K SLoC

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-2022 Mathias Lafeldt

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

Dependencies

~585KB
~12K SLoC