- Home /
Question by
carlos170586001500 · Aug 14, 2017 at 05:35 AM ·
optimizationrandom.rangecheat
XOR+ random Anticheat
Hello, i want to know if is posible prevent Cheat Engine with a random seed + xor encryption:
using System;
using UnityEngine;
namespace BizarreAntiCheat{
[Serializable]
public struct oInt : IEquatable<oInt>, IFormattable{
private static System.Random Random=new System.Random();
[SerializeField]private int key;
[SerializeField]private int val;
[SerializeField]private int va2;
private oInt(int value){
key=Random.Next(int.MinValue, int.MaxValue);
val=Encrypt(key,value);
va2=value;
}
public bool IsCheating(){return Encrypt(key,va2)==val?false:true;}
private int Get(){
if(IsCheating())
Debug.Log("You got bac banned");
return Decrypt(key,val);
}
public static int Encrypt(int k,int v){return k^v;}
public static int Decrypt(int k,int v){return k^v;}
public static implicit operator oInt(int value){Debug.Log("random");return new oInt(value);}
public static implicit operator int(oInt value){return value.Get();}
public override string ToString(){return Get().ToString();}
public string ToString(string format){return Get().ToString(format);}
public string ToString(IFormatProvider provider){return Get().ToString(provider);}
public string ToString(string format, IFormatProvider provider){return Get().ToString(format, provider);}
public override int GetHashCode(){return Get().GetHashCode();}
public override bool Equals(object obj){return !(obj is oInt)?false:Equals((oInt)obj);}
public bool Equals(oInt obj){
if(key==obj.key)
return val==obj.val;
return Decrypt(key,val)==Decrypt(obj.key, obj.val);
}
}
}`
Is the line #13 (Random.Range) a good idea or is unnecesary? Can be undetectable by Cheat Engine with no random number?
private static int KeyDefinedByUser;
private oInt(int value){
key=KeyDefinedByUser;
val=Encrypt(KeyDefinedByUser,value);
va2=value;
}
Sorry my english.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612132648im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Does Unity optimize GLSL? (FROM Glsl) 0 Answers
Performance of 2D Apps on mobile: Optimizations? 0 Answers
Optimize PolygonCollider2D? 0 Answers
What do RenderForwardOpaque::Sort/Render/Prepare do? 0 Answers