Hi, I'm new to assembler and I really need to make this work as it's crucial to my success in this course at college. Normally I wouldn't ask for help, but because time is such a factor now and due to my limited understanding of the language, I feel I need some assistance in order to finish this quickly enough to help. I would be extremely grateful for your assistance. The encryption algorithm is as follows:

1. Read the characters from the file, either as single characters or using buffered input.
2. Treating each character value as an eight bit binary number, rotate the bits (either left or right) by four bit positions.
3. Exclusive-or the character with successive characters from password taken in reverse order.
4. Convert the resulting value to a two character ASCII string that contains the hexadecimal representation of that value. For example, the byte value 0xA8 would be converted to the string “A8”.
5. Swap the two characters and write them to the output file. So, the string “A8” will be written to the file as an 8 followed by an A.

As well as this, I'd like to be able to take input from the console that dictates the file names and passwords, so they're not hardcoded (thus improving ease of use and usefulness). I know the decryption is basically the reverse of this process in a separate program (I'd prefer to keep two separate programs). So far, I can read a file (output it's contents to screen for testing) via 256-byte block reading. I can show my current work if anyone needs to see it. Thanks in advance!

Okay, I am revisiting this after leaving it for a while. I have managed to make the program write to a file, but it's writing garbage data as well as what I want to write. I'm using buffered reading of the file (a standard text file) with just a few test lines in it. But for some reason it writes garbage data and some of the other entries in the data segment as well. Can someone help me with buffered file I/O?

This article has been dead for over six months. Start a new discussion instead.