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

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

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

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Use this simple encryption method to encrypt Vector2Int components, uses passed crypto key.
        /// </summary>
        public static RawEncryptedVector2Int Encrypt(int x, int y, int key)
        {
            if (key == 0)
            {
                key = cryptoKey;
            }

            RawEncryptedVector2Int result;

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

            return(result);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        private int InternalEncryptField(int encrypted)
        {
            var result = ObscuredInt.Encrypt(encrypted, cryptoKey);

            return(result);
        }