Exemplo n.º 1
0
        private float InternalDecryptField(int encrypted)
        {
            var key = cryptoKey;

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

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

            return(result);
        }
        /// <summary>
        /// Use it to decrypt RawEncryptedVector2 you got from Encrypt(), uses passed crypto key.
        /// </summary>
        public static Vector2 Decrypt(RawEncryptedVector2 value, int key)
        {
            if (key == 0)
            {
                key = cryptoKey;
            }

            Vector2 result;

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

            return(result);
        }
        /// <summary>
        /// Use it to decrypt RawEncryptedQuaternion you got from Encrypt(), uses passed crypto key.
        /// </summary>
        public static Quaternion Decrypt(RawEncryptedQuaternion value, int key)
        {
            if (key == 0)
            {
                key = cryptoKey;
            }

            Quaternion result;

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

            return(result);
        }
        private Vector2 InternalDecrypt()
        {
            if (!inited)
            {
                currentCryptoKey = cryptoKey;
                hiddenValue      = Encrypt(zero);
                inited           = true;

                return(zero);
            }

            Vector2 value;

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

            return(value);
        }
        private Quaternion InternalDecrypt()
        {
            if (!inited)
            {
                currentCryptoKey = cryptoKey;
                hiddenValue      = Encrypt(identity);
                inited           = true;

                return(identity);
            }

            Quaternion value;

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

            return(value);
        }