could also be a sign of bad RAM in your computer.
Of all the OS installs I've done throughout the years, of the ones that failed (5%? yes really that many) maybe 1/8 of those were due to an error reported with the media. 80% of THOSE were actually due to bad ram. What happens is the package is decompressed, and then the entire package is checksummed against the stored checksum in the package. If they don't match, it usually reports an error that looks like a bad DVD. But that error is actually indicating bad RAM. (the data while it lived in memory during the decompress got corrupted, and written to disk badly, then failed the checksum later)
Also "detecting a glitch in a flash drive that has downloaded a program?" - as in, you are downloading directly to a usb flash drive? or are you talking about an SSD? Or a Flash player (web browser) download?
A few groups of things publish checksums. When you go to an apple software update download page, it lists the MD5 checksum iirc. And almost all unix repos list the CRC or MD5 or SHA1 of the packages. (geeky users like that have no problem with checksumming packages)
cat (drop flie from Finder into terminal window now) | openssl md5
example in terminal:
apple:~ virtual1 $ cat /Users/virtual1/Desktop/for_mom.jpg | openssl md5
That is the MD5 checksum of the file. Openssl will only checksum the data fork, and only of a single file. You can use that to verify if a file has been damaged, altered, or truncated by comparing this number on the sending and receiving end. there are other options besides md5. Bizarrely enough, CRC32 is not one of them.
I work for the Department of Redundancy Department