コード例 #1
0
        private float InternalDecryptField(int encrypted)
        {
            var key = cryptoKey;

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

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

            return(result);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }