/// <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()
        {
            double decrypted = InternalDecrypt();

            currentCryptoKey = Random.Range(int.MinValue, int.MaxValue);
            hiddenValue      = InternalEncrypt(decrypted, currentCryptoKey);
        }
Ejemplo n.º 2
0
        private double InternalDecrypt()
        {
            if (!inited)
            {
                currentCryptoKey = cryptoKey;
                hiddenValue      = InternalEncrypt(0);
                fakeValue        = 0;
                inited           = true;
            }

            var union = new DoubleLongBytesUnion();

            union.b8 = hiddenValue;

            union.l = union.l ^ currentCryptoKey;

            double decrypted = union.d;

            if (Detectors.ObscuredCheatingDetector.IsRunning && fakeValue != 0 && Math.Abs(decrypted - fakeValue) > 0.000001d)
            {
                Detectors.ObscuredCheatingDetector.Instance.OnCheatingDetected();
            }

            return(decrypted);
        }
Ejemplo n.º 3
0
 private ObscuredDouble(ACTkByte8 PDGAOEAMDCL)
 {
     this.currentCryptoKey = ObscuredDouble.cryptoKey;
     this.hiddenValue      = PDGAOEAMDCL;
     this.hiddenValueOld   = 0;
     this.inited           = true;
 }
Ejemplo n.º 4
0
 private ObscuredDouble(ACTkByte8 value)
 {
     currentCryptoKey = cryptoKey;
     hiddenValue      = value;
     hiddenValueOld   = null;
     fakeValue        = 0;
     inited           = true;
 }
Ejemplo n.º 5
0
 /// <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;
     }
 }
Ejemplo n.º 6
0
 public void SetEncrypted(long LEBNEIHLING)
 {
     this.inited      = true;
     this.hiddenValue = new ObscuredDouble.LPAIILGOHKK()
     {
         l = LEBNEIHLING
     }.b8;
 }
        private ObscuredDouble(double value)
        {
            currentCryptoKey = cryptoKey;
            hiddenValue      = InternalEncrypt(value);
            hiddenValueOld   = null;

            inited = true;
        }
Ejemplo n.º 8
0
 public void ApplyNewCryptoKey()
 {
     if (this.currentCryptoKey == ObscuredDouble.cryptoKey)
     {
         return;
     }
     this.hiddenValue      = ObscuredDouble.InternalEncrypt(this.InternalDecrypt(), ObscuredDouble.cryptoKey);
     this.currentCryptoKey = ObscuredDouble.cryptoKey;
 }
        /// <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);
        }
Ejemplo n.º 10
0
        private ObscuredDouble(double value)
        {
            currentCryptoKey    = cryptoKey;
            hiddenValue         = InternalEncrypt(value);
            hiddenValueOldByte8 = default(ACTkByte8);

            var detectorRunning = Detectors.ObscuredCheatingDetector.ExistsAndIsRunning;

            fakeValue       = detectorRunning ? value : 0L;
            fakeValueActive = detectorRunning;

            inited = true;
        }
Ejemplo n.º 11
0
 private double InternalDecrypt()
 {
     if (!this.inited)
     {
         this.currentCryptoKey = ObscuredDouble.cryptoKey;
         this.hiddenValue      = ObscuredDouble.InternalEncrypt(0.0);
         this.inited           = true;
     }
     ObscuredDouble.LPAIILGOHKK lpaiilgohkk = new ObscuredDouble.LPAIILGOHKK();
     lpaiilgohkk.b8 = this.hiddenValue;
     lpaiilgohkk.l ^= this.currentCryptoKey;
     return(lpaiilgohkk.d);
 }
Ejemplo n.º 12
0
        private ObscuredDouble(double value)
        {
            currentCryptoKey = cryptoKey;
            hiddenValue      = InternalEncrypt(value);
            hiddenValueOld   = null;

            bool detectorRunning = Detectors.ObscuredCheatingDetector.IsRunning;

            fakeValue       = detectorRunning ? value : 0;
            fakeValueActive = detectorRunning;

            inited = true;
        }
Ejemplo n.º 13
0
        /// <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(long encrypted)
        {
            inited = true;
            var union = new DoubleLongBytesUnion();

            union.l = encrypted;

            hiddenValue = union.b8;

            if (Detectors.ObscuredCheatingDetector.IsRunning)
            {
                fakeValue = InternalDecrypt();
            }
        }
Ejemplo n.º 14
0
        private ObscuredDouble(double value)
        {
            currentCryptoKey    = GenerateKey();
            hiddenValue         = Encrypt(value, currentCryptoKey);
            hiddenValueOldByte8 = default(ACTkByte8);

#if UNITY_EDITOR
            fakeValue       = value;
            fakeValueActive = true;
            migratedVersion = null;
#else
            var detectorRunning = Detectors.ObscuredCheatingDetector.ExistsAndIsRunning;
            fakeValue       = detectorRunning ? value : 0L;
            fakeValueActive = detectorRunning;
#endif
            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(long encrypted)
        {
            inited = true;
            var union = new DoubleLongBytesUnion();

            union.l = encrypted;

            hiddenValue = union.b8;

            if (currentCryptoKey == 0)
            {
                currentCryptoKey = cryptoKey;
            }

            if (currentCryptoKey == 0)
            {
                currentCryptoKey = cryptoKey;
            }
        }
        private double InternalDecrypt()
        {
            if (!inited)
            {
                currentCryptoKey = cryptoKey;
                hiddenValue      = InternalEncrypt(0);
                inited           = true;

                return(0);
            }

            var union = new DoubleLongBytesUnion();

            union.b8 = hiddenValue;

            union.l = union.l ^ currentCryptoKey;

            var decrypted = union.d;

            return(decrypted);
        }