Esempio n. 1
0
        public void Encrypt_Ecb_ReturnsVector(byte[] keyBytes, byte[] clearBytes, byte[] cipherBytes)
        {
            //arrange
            var sut      = new BlowfishEncryptor(BlowfishCipherMode.Ecb);
            var expected = cipherBytes;
            //act
            var actual = sut.Encrypt(clearBytes, keyBytes);

            //assert
            Assert.That(actual, Is.EqualTo(expected));
        }
Esempio n. 2
0
        public void Decrypt_Ecb_WhenDecryptedWithEncryptionKey_returnsInput(byte[] input, byte[] key)
        {
            //Arrange
            var sut       = new BlowfishEncryptor(BlowfishCipherMode.Ecb);
            var encrypted = sut.Encrypt(input, key);
            //Act
            var output = sut.Decrypt(encrypted, key);

            //Assert
            Assert.IsTrue(input.SequenceEqual(output));
        }