Esempio n. 1
0
        public string EncodeForOneLine(byte[] lineBytes, byte[] encryptionKeyBytes)
        {
            string toReturn = "";

            for (int j = 0; j < lineBytes.Length; j++)
            {
                toReturn += _fixedXOR.XOR(lineBytes[j], encryptionKeyBytes[j]);
            }

            return(toReturn);
        }
Esempio n. 2
0
        public void GetFixedXOR_GivenHexStrings_GivesGoodXOR()
        {
            // Arrange
            const string STRING1  = "1c0111001f010100061a024b53535009181c";
            const string STRING2  = "686974207468652062756c6c277320657965";
            const string EXPECTED = "746865206b696420646f6e277420706c6179";

            var convertor = new ConvertHex();

            byte[] str1AsBytes = convertor.HexStringToByteArray(STRING1);
            byte[] str2AsBytes = convertor.HexStringToByteArray(STRING2);

            // Act
            var result = _fixedXOR.XOR(str1AsBytes, str2AsBytes);

            // Assert
            result.Should().Be(EXPECTED);
        }