Checksum - Protecting eVoting Files

The following file contains the results of an election:  Votes.txt

The following program can VALIDATE the file:   Checksums.java

The program calculates a check-sum for each line of data in the file.  This is only a prototype - a real security system would perform a much more complex calculation.  The program reads a line of data, then reads the matching checksum from the file, calculates the correct checksum for the data, and then compares the calculated checksum with the one from the file.  If all the checksums match, the program prints "Okay" - otherwise it prints "CORRUPT!"

Data Corruption

There are many possible causes of data corruption:

When the data is really important - like voting results - systems must perform data validation or verification to ensure that the data is correct.

Try It

Download the java program and the votes.txt file (above).  Run the program and check that it prints "okay" for the correct file.  Now try the following:

  1. Try to change the votes so that a different candidate wins.  Then run the check-sum program and see what it says.  
  2. Try to be clever and out-smart the check-sum program.  Can you fool it?
  3. Try just changing the names a little bit.  Can you fool the program?
  4. Make a new file with different results and use the program to compute the correct check-sums.  Then type the correct sums into the file and see if you can convince the program to accept your file.
  5. Read the program and see whether you can explain how the check-sums are calculated.

Read About It

Now do some reading so that you understand the theory behind this type of error-checks.