Xor as Encryption method

Dear friends

can anyone suggest me if there are any errors or faults in using XOR as checksum .

Regards
We normally expect the checksum to be quite small. If you use XOR, you'll get a checksum as large as the original data.
0 is a neutral value in XOR operation... so if your encryption key is a text password and the binary file you encrypt has a lot of 0's, the password will be visible when the "encrypted" file is opened in an editor.
Who said anything about encryption?

It's not clear what you mean by "XOR as checksum". Do you mean use XOR on all the bytes to get the checksum? That will fail to catch errors if the number of swapped bits is even for each bit position for all the bytes. Ex. if 4 bytes have bit 2 swapped and 6 bytes have bit 5 swapped it will not catch that as an error.
Last edited on
Who said anything about encryption?

The OP in the thread title. Which doesn't really make much sense.
Last edited on
As mentioned, it's not a good choice for encryption as-is, but it can be a building block of a light-weight encryption scheme. For example, you can take a pseudo random number generator, and XOR each byte of your message with the nth random number generated by the generator. Then to decrypt, you need the generator's algorithm and the seed, and xor the same way.
Last edited on
Peter87, thanks for the info , but then what could be substituted for that.
You could use XOR but I would recommend that you use with something else, or at least mess up the data a little more after using XOR. The reason is that as Catfish has already stated, 0's are uneffected and any matching characters in the ciphertext and the key will always be set to 0. You could simply multiply the result by the position of the character you are currently encrypting, so something like /*blahblahblah*/ * (i + 1) if you were using a FOR loop for example. This just makes it a little harder to spot the fact that its been XOR encrypted and if used with Cubbi's idea then your XOR encryption program will be alot more secure.
Last edited on
Topic archived. No new replies allowed.