It's not hard if you know a couple of things...
You need to know about file I/O, and bit-shifting. There is some good information about bit shifting in the Programming FAQ.
Something keep in-mind: Bit-shifting throws-away bits. If you shift-left 3 bits, you loose the 3 leftmost bits. This should NOT be a problem with most 16-bit or 32 bit operating systems, assuming that you are encrypting/decrypting ASCII, which only uses 8-bits. You may need to use typecasting or some other tricks to get your data into a type with enough extra bits. Good programming practice would require you to use sizeof() or <limits> to make sure that you never loose any data.
If you want to do bit-rotation, and put those "lost" leftmost bits into the "new" rightmost bits, you'll have to write the code yourself using the other bitwise operators.
I don't know java script, but I sort-of suspect it's too "high-level" to have any bit manipulation instructions. You could do bit-shifting by multiplying and dividing by two (or multiples of two).