C# encrypt string variable
<p>I'm trying to encrypt a text and save the encrypted text to a string
variable and a text file.</p>

<p>But the amazing thing is that the encrypted text in string doesn't look
the same as the encrypted text in a text file .</p>

<p>E.g string  =  bpAz1pcidPuCXbpO+5RYvQ==</p>

<pre><code>textfile  = n3Ö—"tû‚]ºNû”X½ 
</code></pre>

<p>I would really like my string variable to have same data as my
textfile.txt . My intension is to encrypt the string variable not the textfile. 
So how do i encrypt my string variable to look the same way as my textfile data?</p>

<p>Here is my code below :</p>

<pre><code>     byte[] plainTextBytes = Encoding.UTF8.GetBytes("my name is calito");

        MemoryStream memoryStream = new MemoryStream();

        TripleDESCryptoServiceProvider cryptAlgorithm = new TripleDESCryptoServiceProvider();
        CryptoStream csEncrypt = new CryptoStream(memoryStream, cryptAlgorithm.CreateEncryptor(), CryptoStreamMode.Write);

        csEncrypt.Write(plainTextBytes, 0, plainTextBytes.Length);

        //copying encrypted text to string
        byte[] cipherTextBytes = memoryStream.ToArray();
        string cipherText = Convert.ToBase64String(cipherTextBytes);

        //copying incrypted text to text file
        File.WriteAllBytes(@"G:\New Text Document.txt", memoryStream.GetBuffer());  
</code></pre>
