Click here to Skip to main content
14,429,446 members
Rate this:
Please Sign up or sign in to vote.
See more:
in my program, I am encrypting and decrypting a .dat file using the Triple DES algorithm. It encrypts but all the characters in the desination file are replaced with these characters: �$ï/‹%

Here's the code:

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);

           // Read the memory stream and
           // convert it back into byte array
           memStream.Position = 0;
           byte[] result = memStream.ToArray();

           // close and release the streams

           // hand back the encrypted buffer
           return result;
[no name] 15-Jun-14 7:04am
And your question is....?

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

What did you expect encryption to do? Change it to text which says "This is encrypted data."?

Encrypted data is not meant to be readable: that's the whole idea. When you use Triple DES it returns an array of bytes which are encrypted...because it is supposed to.
Kornfeld Eliyahu Peter 15-Jun-14 7:13am
Nםםםם! Yםו שרק מםא דקרןםוד!
Noooo! You are not serious!
OriginalGriff 15-Jun-14 7:53am
ואל תקראו לי שירלי!

Probably...Odd alphabet you have there!
Kornfeld Eliyahu Peter 15-Jun-14 7:57am
Not bad for Google - only one mistake...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100