예제 #1
0
        public void Decode_MessageWithKey_ReturnsMessageDecodedForXorCipherForEnglishAlphabet(
            string message, string key, string encodedMessage)
        {
            var xorCipher = new XORCipher(new EnglishAlphabet());

            var encoded = xorCipher.Decode(message, key);

            Assert.Equal(encodedMessage, encoded);
        }
예제 #2
0
        public void Encode_MessageWithKey_ReturnsMessageEncodedForXorCipherForUkrainianAlphabet(
            string message, string key, string encodedMessage)
        {
            var xorCipher = new XORCipher(new UkrainianAlphabet());

            var encoded = xorCipher.Encode(message, key);

            Assert.Equal(encodedMessage, encoded);
        }
    /// <summary>
    /// Initialize the data manager.
    /// Automatically loads saved data
    /// </summary>
    public override bool Initialize()
    {
        m_gameData = new GameData();
        m_gameData.Initialize();
        m_encryptionSystem = new XORCipher();

        Load();

        m_isInitialized = true;
        return(true);
    }
예제 #4
0
        /// <summary>
        /// XOR.
        /// </summary>
        /// <returns>Result.</returns>
        private byte[] XORProcess()
        {
            var cipher = new XORCipher(sBlock);

            GetSubKeys();

            byte[] res   = new byte[message.Length];
            int    index = 0;

            cipher.SetIV(iv, subKeys);

            foreach (var chunk in ReadByChunk())
            {
                Array.Copy(cipher.EncodeProcess(chunk, subKeys), 0, res, index, chunk.Length);
                index += chunk.Length;
            }
            return(res);
        }