In today IT world everything connected and a lot of data in being downloaded from internet or over networks. This may create some minor problems. The data donwloaded may be corrupted or there may be some intruders in network and with man of the middle attack may change our files. There are different solutions for this but simples and fastest solution is using hash algorithms to verify file integrity. There are different hash function to use but MD5 and SHA1 is popular ones
We will download nmap from nmap servers like below.
$ wget https://nmap.org/dist/nmap-7.21.tgz
Get Hash Values From Site
We will calculate hash of downloaded file nmap-7.31.tgz
Here is the contents of the hash file
Calculate hash of file like below.
$ sha1sum nmap-7.31.tgz
$ md5sum nmap-7.31.tgz
$ sha224sum nmap-7.31.tgz
$ sha512sum nmap-7.31.tgz
As we see bigger sha version creates longer hash because they are more secure.
If we check calculated hash and web site provided hash we can see that everything is ok