Search code examples
javasocketsserverclientchecksum

How to Verify Integrity of Transferred Files in a Client Server Protocol


How do I implement integrity verification using the checksum of files in a client-server protocol where the client sends multiple files to the server. I am using the following steps:

  1. Client connects to the server and sends files.
  2. On server side, when the server receives the files, I have calculated checksum (using this) of client and server files.
  3. Then upon comparing the checksum of client and server files, integrity verification is done.

Is my process ok? Will the checksum calculation be the same if I need to calculate the checksum of video files?


Solution

  • your process sounds OK to me. and the hash function you linked to is operating on byte[], allthough the example uses a text file, so it should work on any sort of file, binary or text.