Question

Terminal > NANO > BASH > XOR Files

I would like to XOR each byte of a file with the corresponding byte of another file, creating an output file of the XOR'ed bytes using BASH.

Currently, I can use the terminal in OS X, changing directories, listing their contents, and using nano. I believe I will need to write a collection of BASH commands in nano and save them as an executable file.

Any hints would be greatly appreciated.

Jim Adrian
jim@futurebeacon.com

Discussion is locked
Follow
Reply to: Terminal > NANO > BASH > XOR Files
PLEASE NOTE: Do not post advertisements, offensive materials, profanity, or personal attacks. Please remember to be considerate of other members. If you are new to the CNET Forums, please read our CNET Forums FAQ. All submitted content is subject to our Terms of Use.
Reporting: Terminal > NANO > BASH > XOR Files
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Comments
- Collapse -
Answer
Didn't find a native command for that.

I can't guess why you would do such a thing but look up the old ROT13 and see if that command will do.
Bob

- Collapse -
Terminal > NANO > BASH > XOR Files

by R. Proffitt Moderator - 9/7/12 9:37 AM

In Reply to: Terminal > NANO > BASH > XOR Files by jamesadrian

I can't guess why you would do such a thing but look up the old ROT13 and see if that command will do.
Bob
-----------------

R. Proffitt,

Thank you for your reply.

I don't know what ROT13 is or where to look for it.

I have read that a ^ b is the command used to XOR a and b. I would guess that the result would become the new A, but I'm not sure. The byte a comes from a text file A, and b is a byte from a file of pseudo-random numbers called B. A can be assumed to have the save file size as B.

I will Google ROT13. All hints are appreciated.

Thank you for your help.

Jim Adrian
jim@futurebeacon.com

- Collapse -
To speed things along.

Try the google before the new post.

http://en.wikipedia.org/wiki/ROT13 shows it along with the "tr" command. Maybe your XOR could be done with a tr command but that's for you to decode since it's your files at risk. I will point out the usual solutions but because you must have a firm grasp of what you are doing, the final code in the script is for you to write.

Sorry, but that's the way I code.
Bob

CNET Forums