游戏中关键数值的保护

逆向某个游戏发现的一个游戏有意思的做法。

public class EncryptInt {
private int _value = 1;
private int INT_SECRET_KEY = 1;
public static Random random = new Random();
public EncryptInt() {
    this.INT_SECRET_KEY = random.Next(0, 0xff);
}
public int Value {
    get {
        int ret = this._value ^ this.INT_SECRET_KEY;
        random = new Random();
        this._value ^ this.INT_SECRET_KEY;
        return ret;
    }
    set {
        this._value = value ^ this.INT_SECRET_KEY;
    }
}
添加新评论