List Info

Thread: C-Sharp (C#) Group: image encryption problem, please help!!




C-Sharp (C#) Group: image encryption problem, please help!!
user name
2006-03-31 18:09:12
Hello, I am having a problem encrypting a tiff image..it
always loses
information after i decrypt and I know it has something to
do with the
encoding but i can't figure it out.  Any help would be
appreciated..
Here is the encrypt function:

private byte[] Encrypt(byte[] bytes)
{
key = new byte[8];
iv = new byte[8];


for (int x = 0; x < 8; x++)
{
        key[x] = Convert.ToByte(textBox3.Text[x]);
        iv[x] = Convert.ToByte(textBox4.Text[x]);



}

DESCryptoServiceProvider cryptProvider = new
DESCryptoServiceProvider();
ICryptoTransform transform =
cryptProvider.CreateEncryptor(key, iv);
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, transform,
CryptoStreamMode.Write);
cs.Write(bytes, 0, bytes.Length);
cs.FlushFinalBlock(); 
ms.Flush(); 

return (ms.GetBuffer());


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.
google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )