示例#1
0
        private int InternalDecryptField(int encrypted)
        {
            var key = cryptoKey;

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

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

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

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

            return(result);
        }
示例#3
0
        private Vector2Int InternalDecrypt()
        {
            if (!inited)
            {
                currentCryptoKey = cryptoKey;
                hiddenValue      = Encrypt(zero);
                inited           = true;

                return(zero);
            }

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

            return(value);
        }