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

                return(zero);
            }

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


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

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

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

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

            return(result);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #5
0
        private int InternalEncryptField(int encrypted)
        {
            var result = TSInt.Encrypt(encrypted, cryptoKey);

            return(result);
        }