Computing the Checksum of a PDF File
Explore how to compute and verify the checksum of a PDF file using Python's hashlib module. Understand different hashing algorithms and implement a lightweight utility to detect file tampering or corruption.
Introduction
Tons of data are being sent over the Internet or other local networks. This data is susceptible to data loss due to network issues or even malicious attacks.
Typically, a checksum is used to ensure that the data received is unharmed and free of errors and losses.
Checksum stands for what
A checksum is the result of running an algorithm, called a cryptographic hash function, on a block of information, standardly a single file. Matching the checksum generated using a specific version of a file, with the one furnished by the original source of the file, confirms that the designated file version is genuine and untampered.
A checksum may have different names. It is commonly called a hash sum, while less common names include hash value, hash code, or simply a hash.
A checksum value by itself is intrinsically a string of letter characters and numbers that act as a sort of fingerprint for a string, a file, or a set of files.
Common reasons for inconsistent checksums
Multiple factors might ...