c++ - binary file encryption problem -


I'm having a problem while encrypting some data in the file. I am using simple xor for that say i have this structure:

  struct MyFile {char fileName [128]; Int account; Float balance;}; Saving it as a binary file is working properly, but when I use an excerpt to encrypt the file name in the structure and save the strait to HD then the structure is not read and the file name decrypting is not displayed Happening. I am using this simple function for the encryption / decryption purpose. Static Zero Codec (Const four * key, int key, four *, four * result, full length) {for (int i = 0; i  

Note that when I encrypt the filename and decrypt it directly into the memory then the result is correct. I remember why it was changed when saved on the hard disk Please answer asap and tnx in advance ...

Note that you have the files Will be opened in binary mode ("rb" / "wb" instead of "r" / "w" for fopen ) especially in the implementation of Windows C < Code> \ n & lt; -> \ r \ n There are problems with conversion.

It's a good idea to use unsigned char for arithmetic and bit wise tasks; Nothing, but 8-bit two supplemented characters may have trouble (which is given, most implementations are used and symmetric XOR encryption can not be a problem, but be careful still is good Is.)


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -