UMBC | CMSC313 |
Then you would encipher the message. If you align the Ap over the Dc, this starting sequence was notated as Ap=Dc. The figure above is Ap=Kc To demonstrate this in another way, Ap=Dc would be:
Plain | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | |
Cipher | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C |
For this project, you are open a file, read in the text (containing only the characters a-z, A-Z, 0-9, the comma, and the period), encipher it and store it in a new file. Just to keep things interesting, you must use system calls to open, read, write, and close files in the current directory. You will read in normal text, but when you write it out, you must print it as five letter groups with a space between groups and ten groups per line for as many lines as necessary:
Additionally, you must convert lower case to upper case before encipherment. Finally, the digits 0 - 9, and the symbols ",", and "." must be spelled out. "1200." becomes "one two zero zero period" After spelling them out, you must then encipher them
You must prompt the user for the first cipher letter (?c). Make sure the user provides a valid first letter (but it can be either upper case or lower case).
;; The conventions used in Linux 2.2, the parameters are stored in left to right ;; order in the registers EBX, ECX, EDX, EDI, and ESI respectively. ;; The man pages show: ;; int creat(const char *pathname, mode_t mode); ;; mov eax, dword CREATE ; System Call -- open ;; mov ebx, myFile1 ; Pointer to filename ;; mov ecx, O_WRONLY ; Flag for Write Only ;; mov edx, 01FDh ; Mode -- 755 in octal ;; int 80h ;; mov dword [ fdWrite ], eax; save the file descriptor ;; int open(const char *pathname, int flags, mode_t mode); ;; mov eax, dword OPEN ; System Call -- open ;; mov ebx, myFile ; Pointer to filename ;; mov ecx, O_RDONLY ; Flag for Read Only ;; mov edx, 0 ; Mode -- not used to open existing file ;; int 80h ;; mov dword [ fdRead ], eax ; save the file descriptor ;; ssize_t read(int fd, void *buf, size_t count); ;; mov eax, READ ; System Call -- read ;; mov ebx, dword [ fdRead ]; File descriptor opened for reading ;; mov ecx, dword inBuff ; Pointer to input buffer ;; mov edx, dword BUFSIZE ; Number of bytes to read ;; int 80h ;; mov dword [ bytesRead ], eax ; Actual amount read ;; ssize_t write(int fd, const void *buf, size_t count); ;; mov eax, WRITE ; System Call -- write ;; mov ebx, dword [ fdWrite ]; File descriptor opened for writing ;; mov ecx, dword outBuff ; Pointer to output buffer ;; mov edx, dword [ bytesWritten ] ; Number of bytes to write ;; mov 80h ;; int close(int fd); ;; mov eax, CLOSE ;; mov ebx, dword [ fdRead ] ;; int 80h ;; ;; What is this size_t/ssize_t/mode_t stuff????? ;; /usr/src/linux/include/asm-i386/posix_types.h:typedef unsigned short __kernel_mode_t; ;; /usr/src/linux/include/linux/types.h: typedef __kernel_mode_t mode_t; ;; /usr/src/linux/include/asm-i386/posix_types.h:typedef int __kernel_ssize_t; ;; /usr/src/linux/include/linux/types.h: typedef __kernel_ssize_t ssize_t; ;; /usr/src/linux/include/asm-i386/posix_types.h:typedef unsigned int __kernel_size_t ;; /usr/src/linux/include/linux/types.h: typedef __kernel_size_t size_t; ;; ;; in /usr/include/bits/fcntl.h: ;; ;; O_RDONLY 00 ;; O_WRONLY 01 ;; O_RDWR 02 %define O_RDONLY 00 %define O_WRONLY 01 %define O_RDWR 02
;; Filename: jdoe1p1.asm ;; Name: Ima Student ;; email: jdoe1@umbc.edu ;; Date: 18 Mar 2005 ;; Course: CMSC313 ;; Description: (Your psuedocode goes here. Must be detailed) ;; Notes: (As needed, such has how to compile)