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!"
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.
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:
Now do some reading so that you understand the theory behind this type of error-checks.