2 releases
0.1.2 | Dec 28, 2021 |
---|---|
0.1.1 |
|
0.1.0 | Dec 25, 2021 |
#1198 in Game dev
30KB
442 lines
obfuscate integer -- against Cheat Engine Users
This is a crate which may stop most Cheat Engine (and other variants) program scanning for the relative address, and thus stop further modification.
Published under GPL v3 or later.
update log
v0.1.1 - v0.1.2
- hotfix in v0.1.2: delete the main function.
- add a README.md file
- add some unsafe code into the crate to make the program more random.
v0.1.0
- initial commit
lib.rs
:
This is a crate for test purpose, which may stop most Cheat Engine (and other variants)
program scanning for the relative address, and thus stop further modification.
most of the type here provided start with an 'O' and the remain parts are the same to its actual kind
e.g., Oi32
is actually an obfuscate i32
actually for most Cheat Engine user, it is difficult even modify a very simple program with Oi32
license: GPL-v3 or later
Examples
#![feature(bench_black_box)]
use std::hint::black_box;
#[macro_use] // if you want to import the macro
extern crate obfuscate_integer;
use obfuscate_integer::*;
fn main(){cai!{
let mut player_hp:Oi32:=500000;
let mut enemy_hp:Oi32:=1000000;
let mut round:Oi16:=0;
let now=std::time::Instant::now();
loop{
round+=1;
enemy_hp-=1;
if enemy_hp<0 {break}
player_hp-=1;
if player_hp<0 {break}
}
println!("execute 5000000 loops, cost {:?}",now.elapsed());
let mut player_hp:Oi32:=500000;
let mut enemy_hp:Oi32:=1000000;
let mut round:Oi16:=0;
let now=std::time::Instant::now();
loop{
round+=black_box(1);
enemy_hp-=black_box(1);
if enemy_hp<0 {break}
player_hp-=black_box(1);
if player_hp<0 {break}
}
println!("execute 5000000 loops, cost {:?}",now.elapsed());
let mut stdin = std::io::stdin();
let mut player_hp:Oi32:=500000;
let mut enemy_hp:Oi32:=1000000;
let mut round:Oi16:=0;
let mut buffer = String::new();
} // at least 0.1.0, `cai!` does not support complicated instructions like the following one. it might be solved in future versions.
if loop{
round+=1;
println!("Round {} is comming, player's hp is {} and enemy's hp is {}. Press `Enter` to continue.",&round,&player_hp,&enemy_hp);
stdin.read_line(&mut buffer).unwrap();
buffer.clear();
enemy_hp-=1;
if enemy_hp<0 {break true}
player_hp-=1;
if player_hp<0 {break false}
}{
println!("You win!");
}else{
println!("You dead.");
}
}
Restrictions
program must be compiled with overflow-checks = false
, since Debug mode could not handle the highly possible wrapping ops.
using std::hint::black_box, it is not difficult figure out that Oi32 makes program run 100x slower than using i32
thus, do not use Oi* or Ou* dealing massive calculations.
for normal (e.g., gaming) use, that is acceptable.