i implement AES 256 bit algorithm in C# but i am encrypting 128bit block of plain text which require padding so i dont want to pad and want use to stream cipher
- use stream cipher instead of using 128 bit block
encrypt stream byte by byte
CryptLib _crypt = new CryptLib(); //string plainText = "This is the text to be encrypted"; String iv = CryptLib.GenerateRandomIV(16); //16 bytes = 128 bits string key = CryptLib.getHashSha256("my secret key", 31); //32 bytes = 256 bits MessageBox.Show(arm);////////////////////// String cypherText = _crypt.encrypt(string1, key, iv); Console.WriteLine("iv=" + iv); Console.WriteLine("key=" + key); Console.WriteLine("Cypher text=" + cypherText); MessageBox.Show(cypherText); textBox1.Text = cypherText; Console.WriteLine("Plain text =" + _crypt.decrypt(cypherText, key, iv)); MessageBox.Show(_crypt.decrypt(cypherText, key, iv)); String dypher = _crypt.decrypt(cypherText, key, iv); string outp = string.Empty; char[] value = dypher.ToCharArray();