Example #1
0
        private Vector2Int InternalDecrypt()
        {
            if (!inited)
            {
                currentCryptoKey = cryptoKey;
                hiddenValue      = Encrypt(zero);
                fakeValue        = zero;
                fakeValueActive  = false;
                inited           = true;

                return(zero);
            }

            var value = new Vector2Int
            {
                x = TSInt.Decrypt(hiddenValue.x, currentCryptoKey),
                y = TSInt.Decrypt(hiddenValue.y, currentCryptoKey)
            };

            if (ObscuredCheatingDetector.ExistsAndIsRunning && fakeValueActive && value != fakeValue)
            {
                ObscuredCheatingDetector.Instance.OnCheatingDetected();
            }

            return(value);
        }
Example #2
0
        private int InternalDecryptField(int encrypted)
        {
            var key = cryptoKey;

            if (currentCryptoKey != cryptoKey)
            {
                key = currentCryptoKey;
            }

            var result = TSInt.Decrypt(encrypted, key);

            return(result);
        }
Example #3
0
        /// <summary>
        /// 简单的对称加密,使用默认的加密密钥。
        /// </summary>
        public static EncryptedVector2Int Encrypt(int x, int y, int key)
        {
            if (key == 0)
            {
                key = cryptoKey;
            }

            EncryptedVector2Int result;

            result.x = TSInt.Encrypt(x, key);
            result.y = TSInt.Encrypt(y, key);

            return(result);
        }
Example #4
0
        /// <summary>
        /// 解密
        /// </summary>
        public static Vector2Int Decrypt(EncryptedVector2Int value, int key)
        {
            if (key == 0)
            {
                key = cryptoKey;
            }

            var result = new Vector2Int
            {
                x = TSInt.Decrypt(value.x, key),
                y = TSInt.Decrypt(value.y, key)
            };

            return(result);
        }
Example #5
0
        private int InternalEncryptField(int encrypted)
        {
            var result = TSInt.Encrypt(encrypted, cryptoKey);

            return(result);
        }