Skip to content

ashtonmendes/Base64-Encoding-Decoding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

<TITLE>Homework #1 - CSCI 531, Spring 2015</TITLE>
<TD ALIGN=LEFT VALIGN=TOP>
<!-- COL 3, every page should be different -->
    <TABLE BORDER=0>
    <!-- Page Header -->
    
    
    <TR><TD>&nbsp;</TD></TR>
    <!-- Section -->
    <TR><TD COLSPAN=3 ALIGN=LEFT BGCOLOR="#000000" WIDTH=100%>
            <FONT COLOR="#ffffff"><A
            NAME="intro"><B>Assignment</B></A></FONT>
        </TD>
    </TR>
    <!-- Top Section -->
    <TR><TD COLSPAN=3 ALIGN=LEFT>

The purpose of this assignment is to get acquainted with manipulating bits in memory and files.

 
Compiling
    make hw1
an executable named hw1 is created.
 
Commandline Syntax & Program Output
The commandline syntax for hw1 is as follows:
    hw1 hexdump [file]
    hw1 enc-base64 [file]
    hw1 dec-base64 [file]

Square bracketed items are optional. Follows the UNIX convention that commandline options can come in any order, if applicable. If file is not specified, the program reads from stdin. File or stdin will be referred as input below. Output of the program goes to stdout and error messages go to stderr.

The meaning of the commands are:

hexdump   :   Produce a hexdump of file (or stdin).
enc-base64   :   Base64 encode file (or stdin).
dec-base64   :   Base64 decode file (or stdin).

The output for various commands are as follows.

hexdump   :   Please note that there is one space character between the address field and the first data byte. In outputing the first 8 data bytes, you must use one space character to separate each byte. This is followed by two space characters. In outputing the next 8 data bytes, you must again use one space character to separate each byte. Then follow it by two space characters and 16 ASCII characters (one for each data byte). The rules for the last 16 characters in a line is as follows.

If the data byte is >=0x20 and <=0x7e you should use the corresponding ASCII character. If the data byte is <=0x1f or equals to 0x7f, you should print a period character. If the data byte is >=0x80 you should print a ~ character.

In addition, non-existant bytes (at the end of the file) should by displayed as -- and use space characters in the right column.

 
enc-base64   :   You should compare your result against the result of running the following at a command prompt:
    openssl enc -e -base64 -in file
Please note that each line in the output must have at most 64 characters. In addition, all output lines, except for the last one, must contain exactly 64 characters (plus a '\n' at the end).
 
dec-base64   :   You should compare your result against the result of running the following at a command prompt:
    openssl enc -d -base64 -in file
Please note that you should ignore linebreaks in the input file. Even if the input is one character per line, your program should still work. Please also note that if the input file is garbage, your code must not crash!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published