|
(for the week commencing 17th March 2008)
- Examine the three "industry-standard" checksum algorithms
discussed in Lecture 1:
checksum_crc16(), checksum_ccitt() and
checksum_internet().
Their source code is provided in
/cslinux/examples/CITS3230/Lab1.
Using the simple function corrupt_frame()
in the file corrupt_frame.c write a program to demonstrate that
these checksum algorithms are very robust.
Think before coding (often a good technique):
- what am I trying to measure?
- what is considered a success, and what a failure?
- how will I report my results?
- The Linux system call getrusage()
may be used to measure the execution time and resource usage of a process.
Using getrusage(),
is any of the three given checksum algorithms significantly
faster than the others?
How important a factor is speed in choosing a suitable checksum algorithm?
- Extending your tests of Q1, how successful a checksum function is
a (naive) routine which simply adds up all bytes in a buffer to be
transmitted?
- The file /cslinux/examples/CITS3230/Lab1/Q4.output
contains the output of the C loop:
if((fd = open("Q4.output", O_CREAT|O_WRONLY, 0600)) >= 0) {
for(int i = -50 ; i<50 ; i++)
write(fd, &i, sizeof(i));
close(fd);
}
when compiled and executed on a Sun SPARC computer
(of which our School used to own a great number,
but now almost exclusively relies on Intel Pentiums).
Note that the integers have been written as "raw" binary values,
not their text equivalents as produced by C's printf() function,
or Java's toString methods.
Write a short program under either Linux or Windows-XP in our School's
labs to read back the 100 integers and display them.
- What do you observe and why?
- Does the Linux program named od offer any help
(run man od)?
- What consequences do your observations have for computer networking?
When finished, you may wish to look at the code in
/cslinux/examples/CITS3230/Lab1/creditcard.c.
Consider how it could be modified to generate valid credit-card numbers
(though not necessarily the numbers of valid credit-cards).
Of course, do not do this.
Then, do not consider how such programs could be used against
simplistic eCommerce web-sites.
NOTE: If you do not have file-system permissions to read or execute
certain files in the directory,
it is because they have have not yet been "released" to you.
Chris McDonald
March 2008.
|