i need help in these section, i uploaded a pdf file and converted it to a binary file and then
i want to encrypt the username and password string and embedding that to the excisting binary file what we have created from the
pdf formats
with regards
kannan
Loading
d gPosted Jun 11, 2006, 12:06 PM
...if you read the .pdf byte by byte not using the TextReader class then I guess thats considered binary... anyways, an easy way to encrypt is to use XOR encryption. Its weak yes, but unless you're trying to hide something from the government or large organization, most people won't realize the encrypted values are even encrypted, and if they do realize it they likely won't go through the effort of decrypting it...
To XOR a byte (one character) in C#, use:
decrypted_byte1 = unencrypted_byte1 ^ byte2;
Now to make it much harder to decrypt don't use byte2 repeatedly, make it cycle through a very long string.
to decrypt, do the same thing over again:
unencrypted_byte1 = decrypted_byte1 ^ byte2;
Be careful... if you use a string to encrypt/decrypt then misplacing the offset can cause information loss. Also, don't try XOR encryption on text files by using the textReader class, that class doesn't like to write (or read) non-standard characters, always read & write byte by byte