Exemplo n.º 1
0
        private Quaternion InternalDecrypt()
        {
            if (!inited)
            {
                currentCryptoKey = cryptoKey;
                hiddenValue      = Encrypt(identity);
                fakeValue        = identity;
                fakeValueActive  = false;
                inited           = true;

                return(identity);
            }

            Quaternion value;

            value.x = TSFloat.Decrypt(hiddenValue.x, currentCryptoKey);
            value.y = TSFloat.Decrypt(hiddenValue.y, currentCryptoKey);
            value.z = TSFloat.Decrypt(hiddenValue.z, currentCryptoKey);
            value.w = TSFloat.Decrypt(hiddenValue.w, currentCryptoKey);

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

            return(value);
        }
Exemplo n.º 2
0
        private Vector3 InternalDecrypt()
        {
            if (!inited)
            {
                currentCryptoKey = cryptoKey;
                hiddenValue      = Encrypt(zero, cryptoKey);
                fakeValue        = zero;
                fakeValueActive  = false;
                inited           = true;

                return(zero);
            }

            Vector3 value;

            value.x = TSFloat.Decrypt(hiddenValue.x, currentCryptoKey);
            value.y = TSFloat.Decrypt(hiddenValue.y, currentCryptoKey);
            value.z = TSFloat.Decrypt(hiddenValue.z, currentCryptoKey);

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

            return(value);
        }
Exemplo n.º 3
0
        private float InternalDecryptField(int encrypted)
        {
            var key = cryptoKey;

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

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

            return(result);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 解密
        /// </summary>
        public static Vector2 Decrypt(EncryptedVector2 value, int key)
        {
            if (key == 0)
            {
                key = cryptoKey;
            }

            Vector2 result;

            result.x = TSFloat.Decrypt(value.x, key);
            result.y = TSFloat.Decrypt(value.y, key);

            return(result);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 简单的对称加密,使用默认的加密密钥。
        /// </summary>
        public static EncryptedVector2 Encrypt(float x, float y, int key)
        {
            if (key == 0)
            {
                key = cryptoKey;
            }

            EncryptedVector2 result;

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

            return(result);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 解密
        /// </summary>
        public static Quaternion Decrypt(EncryptedQuaternion value, int key)
        {
            if (key == 0)
            {
                key = cryptoKey;
            }

            Quaternion result;

            result.x = TSFloat.Decrypt(value.x, key);
            result.y = TSFloat.Decrypt(value.y, key);
            result.z = TSFloat.Decrypt(value.z, key);
            result.w = TSFloat.Decrypt(value.w, key);

            return(result);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 简单的对称加密,使用默认的加密密钥。
        /// </summary>
        public static EncryptedQuaternion Encrypt(float x, float y, float z, float w, int key)
        {
            if (key == 0)
            {
                key = cryptoKey;
            }

            EncryptedQuaternion result;

            result.x = TSFloat.Encrypt(x, key);
            result.y = TSFloat.Encrypt(y, key);
            result.z = TSFloat.Encrypt(z, key);
            result.w = TSFloat.Encrypt(w, key);

            return(result);
        }
Exemplo n.º 8
0
        private int InternalEncryptField(float encrypted)
        {
            var result = TSFloat.Encrypt(encrypted, cryptoKey);

            return(result);
        }