I had an issue where I ran a vendor provided install script and my kernel sound drivers were deleted. I recovered them just fine, but it had me wondering about how I could be sure that no other files were missing or corrupted.
After some searching online I found a reference to someone checking a package using dpkg’s md5sums. This and some poking around gave me what I needed.
sudo /usr/bin/md5sum -c /var/lib/dpkg/info/*.md5sums | tee /tmp/md5sum_results.txt
After that run is complete you can use grep to find things that are not OK and investigate them. If this is to be used for security validation the md5sums and related tools need to be stored on read only media.