private decimal InternalDecrypt() { if (!inited) { currentCryptoKey = cryptoKey; hiddenValue = InternalEncrypt(0m); fakeValue = 0m; fakeValueActive = false; inited = true; return(0m); } var union = new DecimalLongBytesUnion(); union.b16 = hiddenValue; union.l1 = union.l1 ^ currentCryptoKey; union.l2 = union.l2 ^ currentCryptoKey; var decrypted = union.d; if (Detectors.ObscuredCheatingDetector.ExistsAndIsRunning && fakeValueActive && decrypted != fakeValue) { Detectors.ObscuredCheatingDetector.Instance.OnCheatingDetected(); } return(decrypted); }
/// <summary> /// Allows to change current crypto key to the new random value and re-encrypt variable using it. /// Use it for extra protection against 'unknown value' search. /// Just call it sometimes when your variable doesn't change to fool the cheater. /// </summary> public void RandomizeCryptoKey() { decimal decrypted = InternalDecrypt(); currentCryptoKey = Random.Range(int.MinValue, int.MaxValue); hiddenValue = InternalEncrypt(decrypted, currentCryptoKey); }
/// <summary> /// Allows to change current crypto key to the new random value and re-encrypt variable using it. /// Use it for extra protection against 'unknown value' search. /// Just call it sometimes when your variable doesn't change to fool the cheater. /// </summary> public void RandomizeCryptoKey() { var decrypted = InternalDecrypt(); currentCryptoKey = ThreadSafeRandom.Next(); hiddenValue = InternalEncrypt(decrypted, currentCryptoKey); }
/// <summary> /// Allows to explicitly set current obscured value. Crypto key should be same as when encrypted value was got with GetEncrypted(). /// </summary> /// Use it in conjunction with GetEncrypted().<br/> /// Useful for loading data stored in obscured state. /// \sa FromEncrypted() public void SetEncrypted(decimal encrypted) { inited = true; var union = new DecimalLongBytesUnion(); union.d = encrypted; hiddenValue = union.b16; if (currentCryptoKey == 0) { currentCryptoKey = cryptoKey; } if (Detectors.ObscuredCheatingDetector.ExistsAndIsRunning) { fakeValueActive = false; fakeValue = InternalDecrypt(); fakeValueActive = true; } else { fakeValueActive = false; } }
private ObscuredDecimal(decimal value) { currentCryptoKey = cryptoKey; hiddenValue = InternalEncrypt(value); inited = true; }
private ObscuredDecimal(ACTkByte16 PDGAOEAMDCL) { this.currentCryptoKey = ObscuredDecimal.cryptoKey; this.hiddenValue = PDGAOEAMDCL; this.hiddenValueOld = 0; this.inited = true; }
public void RandomizeCryptoKey() { var decrypted = InternalDecrypt(); currentCryptoKey = GenerateKey(); hiddenValue = InternalEncrypt(decrypted, currentCryptoKey); }
public void SetEncrypted(Decimal LEBNEIHLING) { this.inited = true; this.hiddenValue = new ObscuredDecimal.HAIHIJOPFAC() { d = LEBNEIHLING }.b16; }
private ObscuredDecimal(ACTkByte16 value) { currentCryptoKey = cryptoKey; hiddenValue = value; hiddenValueOld = null; fakeValue = 0m; inited = true; }
/// <summary> /// Use it after SetNewCryptoKey() to re-encrypt current instance using new crypto key. /// </summary> public void ApplyNewCryptoKey() { if (currentCryptoKey != cryptoKey) { hiddenValue = InternalEncrypt(InternalDecrypt(), cryptoKey); currentCryptoKey = cryptoKey; } }
public void ApplyNewCryptoKey() { if (this.currentCryptoKey == ObscuredDecimal.cryptoKey) { return; } this.hiddenValue = ObscuredDecimal.InternalEncrypt(this.InternalDecrypt(), ObscuredDecimal.cryptoKey); this.currentCryptoKey = ObscuredDecimal.cryptoKey; }
public void RandomizeCryptoKey() { Decimal PDGAOEAMDCL = this.InternalDecrypt(); do { this.currentCryptoKey = (long)0; }while (this.currentCryptoKey == 0L); this.hiddenValue = ObscuredDecimal.InternalEncrypt(PDGAOEAMDCL, this.currentCryptoKey); }
/// <summary> /// Allows to change current crypto key to the new random value and re-encrypt variable using it. /// Use it for extra protection against 'unknown value' search. /// Just call it sometimes when your variable doesn't change to fool the cheater. /// </summary> public void RandomizeCryptoKey() { var decrypted = InternalDecrypt(); do { currentCryptoKey = Random.Range(int.MinValue, int.MaxValue); }while (currentCryptoKey == 0); hiddenValue = InternalEncrypt(decrypted, currentCryptoKey); }
private ObscuredDecimal(decimal value) { currentCryptoKey = cryptoKey; hiddenValue = InternalEncrypt(value); var detectorRunning = Detectors.ObscuredCheatingDetector.ExistsAndIsRunning; fakeValue = detectorRunning ? value : 0m; fakeValueActive = detectorRunning; inited = true; }
/// <summary> /// Allows to explicitly set current obscured value. /// </summary> /// Use it in conjunction with GetEncrypted().<br/> /// Useful for loading data stored in obscured state. public void SetEncrypted(decimal encrypted) { inited = true; DecimalLongBytesUnion union = new DecimalLongBytesUnion(); union.d = encrypted; hiddenValue = union.b16; if (Detectors.ObscuredCheatingDetector.IsRunning) { fakeValue = InternalDecrypt(); } }
private Decimal InternalDecrypt() { if (!this.inited) { this.currentCryptoKey = ObscuredDecimal.cryptoKey; this.hiddenValue = ObscuredDecimal.InternalEncrypt(0M); this.inited = true; } ObscuredDecimal.HAIHIJOPFAC haihijopfac = new ObscuredDecimal.HAIHIJOPFAC(); haihijopfac.b16 = this.hiddenValue; haihijopfac.l1 ^= this.currentCryptoKey; haihijopfac.l2 ^= this.currentCryptoKey; return(haihijopfac.d); }
/// <summary> /// Allows to explicitly set current obscured value. /// </summary> /// Use it in conjunction with GetEncrypted().<br/> /// Useful for loading data stored in obscured state. public void SetEncrypted(decimal encrypted) { inited = true; var union = new DecimalLongBytesUnion(); union.d = encrypted; hiddenValue = union.b16; if (currentCryptoKey == 0) { currentCryptoKey = cryptoKey; } }
private ObscuredDecimal(decimal value) { currentCryptoKey = GenerateKey(); hiddenValue = InternalEncrypt(value, currentCryptoKey); #if UNITY_EDITOR fakeValue = value; fakeValueActive = true; #else var detectorRunning = Detectors.ObscuredCheatingDetector.ExistsAndIsRunning; fakeValue = detectorRunning ? value : 0m; fakeValueActive = detectorRunning; #endif inited = true; }
/// <summary> /// Allows to explicitly set current obscured value. Crypto key should be same as when encrypted value was got with GetEncrypted(). /// </summary> /// Use it in conjunction with GetEncrypted().<br/> /// Useful for loading data stored in obscured state. /// \sa FromEncrypted() public void SetEncrypted(decimal encrypted, long key) { inited = true; hiddenValue = DecimalLongBytesUnion.ConvertDecimalToB16(encrypted); currentCryptoKey = key; if (Detectors.ObscuredCheatingDetector.ExistsAndIsRunning) { fakeValueActive = false; fakeValue = InternalDecrypt(); fakeValueActive = true; } else { fakeValueActive = false; } }
private decimal InternalDecrypt() { if (!inited) { currentCryptoKey = GenerateKey(); hiddenValue = InternalEncrypt(0m, currentCryptoKey); fakeValue = 0m; fakeValueActive = false; inited = true; return(0m); } var decrypted = DecimalLongBytesUnion.XorB16ToDecimal(hiddenValue, currentCryptoKey); if (Detectors.ObscuredCheatingDetector.ExistsAndIsRunning && fakeValueActive && decrypted != fakeValue) { Detectors.ObscuredCheatingDetector.Instance.OnCheatingDetected(); } return(decrypted); }
private decimal InternalDecrypt() { if (!inited) { currentCryptoKey = cryptoKey; hiddenValue = InternalEncrypt(0m); inited = true; return(0m); } var union = new DecimalLongBytesUnion(); union.b16 = hiddenValue; union.l1 = union.l1 ^ currentCryptoKey; union.l2 = union.l2 ^ currentCryptoKey; var decrypted = union.d; return(decrypted); }
private static DecimalLongBytesUnion FromB16(ACTkByte16 value) { return(new DecimalLongBytesUnion { b16 = value }); }
internal static decimal ConvertB16ToDecimal(ACTkByte16 value) { return(FromB16(value).d); }
internal static decimal XorB16ToDecimal(ACTkByte16 value, long key) { return(FromB16(value).XorLongs(key).d); }