#ps2 #homebrew #codebreaker #gamehacking

no-std codebreaker

Decrypt & encrypt any cheat code for CodeBreaker PS2

15 releases

Uses new Rust 2021

0.3.0 Dec 24, 2021
0.2.6 Nov 6, 2021
0.2.5 Oct 17, 2021
0.2.4 Sep 12, 2021
0.1.6 May 26, 2020

#29 in Games

Download history 12/week @ 2021-09-26 5/week @ 2021-10-03 8/week @ 2021-10-10 19/week @ 2021-10-17 5/week @ 2021-10-24 16/week @ 2021-10-31 25/week @ 2021-11-07 21/week @ 2021-11-14 19/week @ 2021-11-21 30/week @ 2021-11-28 27/week @ 2021-12-05 20/week @ 2021-12-12 30/week @ 2021-12-19 30/week @ 2021-12-26 24/week @ 2022-01-02 21/week @ 2022-01-09

109 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.2"

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.2", default-features = false }

License

Copyright (c) 2020 Mathias Lafeldt

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

Dependencies

~520KB
~11K SLoC

a