public static int Encrypt(float value, int key) { ObscuredFloat.FloatIntBytesUnion floatIntBytesUnion = default(ObscuredFloat.FloatIntBytesUnion); floatIntBytesUnion.f = value; floatIntBytesUnion.i ^= key; return(floatIntBytesUnion.i); }
public int GetEncrypted() { this.ApplyNewCryptoKey(); ObscuredFloat.FloatIntBytesUnion floatIntBytesUnion = default(ObscuredFloat.FloatIntBytesUnion); floatIntBytesUnion.b1 = this.hiddenValue[0]; floatIntBytesUnion.b2 = this.hiddenValue[1]; floatIntBytesUnion.b3 = this.hiddenValue[2]; floatIntBytesUnion.b4 = this.hiddenValue[3]; return(floatIntBytesUnion.i); }
private static byte[] InternalEncrypt(float value, int key) { int num = key; if (num == 0) { num = ObscuredFloat.cryptoKey; } ObscuredFloat.FloatIntBytesUnion floatIntBytesUnion = new ObscuredFloat.FloatIntBytesUnion(); floatIntBytesUnion.f = value; floatIntBytesUnion.i ^= num; return(new byte[4] { floatIntBytesUnion.b1, floatIntBytesUnion.b2, floatIntBytesUnion.b3, floatIntBytesUnion.b4 }); }
public void SetEncrypted(int encrypted) { this.inited = true; ObscuredFloat.FloatIntBytesUnion floatIntBytesUnion = default(ObscuredFloat.FloatIntBytesUnion); floatIntBytesUnion.i = encrypted; this.hiddenValue = new byte[] { floatIntBytesUnion.b1, floatIntBytesUnion.b2, floatIntBytesUnion.b3, floatIntBytesUnion.b4 }; if (ObscuredCheatingDetector.IsRunning) { this.fakeValue = this.InternalDecrypt(); } }
private float InternalDecrypt() { if (!this.inited) { this.currentCryptoKey = ObscuredFloat.cryptoKey; this.hiddenValue = ObscuredFloat.InternalEncrypt(0f); this.fakeValue = 0f; this.inited = true; } ObscuredFloat.FloatIntBytesUnion floatIntBytesUnion = default(ObscuredFloat.FloatIntBytesUnion); floatIntBytesUnion.b1 = this.hiddenValue[0]; floatIntBytesUnion.b2 = this.hiddenValue[1]; floatIntBytesUnion.b3 = this.hiddenValue[2]; floatIntBytesUnion.b4 = this.hiddenValue[3]; floatIntBytesUnion.i ^= this.currentCryptoKey; float f = floatIntBytesUnion.f; if (ObscuredCheatingDetector.IsRunning && this.fakeValue != 0f && Math.Abs(f - this.fakeValue) > ObscuredCheatingDetector.Instance.floatEpsilon) { ObscuredCheatingDetector.Instance.OnCheatingDetected(); } return(f); }
public static float Decrypt(int value, int key) { ObscuredFloat.FloatIntBytesUnion floatIntBytesUnion = default(ObscuredFloat.FloatIntBytesUnion); floatIntBytesUnion.i = (value ^ key); return(floatIntBytesUnion.f); }