public byte[] Transform(byte[] input, ICryptoTransform CryptoTransform) { // create the necessary streams MemoryStream memStream = new MemoryStream(); CryptoStream cryptStream = new CryptoStream(memStream, CryptoTransform, CryptoStreamMode.Write); // transform the bytes as requested cryptStream.Write(input, 0, input.Length); cryptStream.FlushFinalBlock(); // Read the memory stream and // convert it back into byte array memStream.Position = 0; byte[] result = memStream.ToArray(); // close and release the streams memStream.Close(); cryptStream.Close(); // hand back the encrypted buffer return result; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)