Check md5 amount. What is a checksum (hash) and how can I verify it? How to check files for integrity

Sometimes, when downloading files from the Internet, there are times when files are downloaded "broken", that is, corrupted... Why this happens, we will not consider now, there can be a lot of reasons.

To make sure the integrity of the downloaded file, you need to check the MD5 amount.

Every self-respecting author or resource that offers large files for downloading, should publish along with the file size its MD5 amountso that the user was able to check the uploaded file and find out if it is broken or not.
You have probably seen similar designations on some sites - "MD5 checksum:".

How to check files for integrity

When should this check be done? Then, when you download large files (DVD), programs, video tutorials, operating systems and more.

Checking the MD5 amount you will be sure that the file is intact and not damaged. The program itself is so simple to use that there is nothing to describe.

MD5 FileChecker does not require installation on a PC, but is launched with a regular .exe file.

After unpacking from the archive. Run the shortcut Md5Checker.exe

How do I use MD5 FileChecker? Select the required file with the "Browse" button, use the "Calculate" button to calculate the MD5 amount of the loaded file, and in the third line insert the declared MD5 amount and click "Check".


If the program "says " that the sums match - it means the file is safe and sound. Feel free to download and use it.

therefore download the free MD5 FileChecker software on your PC and use it with pleasure.

The easiest way to check MD5 (hash sum) in Linux is in the terminal. Through any graphical interface, you will need to do more manipulations than just command the following in the Linux terminal:

Md5sum /home/pavel/Distributions/lubuntu-12.04-desktop-i386.iso

It goes without saying that the path to the file you need, (/home/pavel/Distributions/lubuntu-12.04-desktop-i386.iso) you need to write your own, the one that corresponds to the desired object for counting MD5 amounts in Linux.

To avoid entering the file path manually, you can copy it as follows. Through the file manager, go to the directory where the file we need is actually located. The address line in the file manager must be converted from the "icons" view to the text view, using the keys , then you can copy the path either with the mouse through the right click, or with the keys ... Go to the terminal and add our path with the full name of the file to the written command "md5sum" through a space.

$ md5sum /home/pavel/Distributions/lubuntu-12.04-desktop-i386.iso /home/pavel/Distributions/lubuntu-12.04-desktop-i386.iso

Linux commands are standard for everyone, which means that the command md5sum suitable for any distribution Linuxwherever you are. This is one of the advantages of the command line !!!

MD5 (hash) checks are required after downloading large files, which will not work properly if any files are damaged or changed in some way. MD5 checks are mainly applied to .iso files, most often to distributions. If the .ISO file is damaged, then it should not be written to a USB stick (flash drive), and even more so to an optical disk, the Linux distribution kit will report an error of any files during installation.

After burning the Linux distribution to an optical disk, you need to check the integrity, find out its MD5 amount

In this article, we will continue to delve into the world of the command line and check the MD5 of the recorded optical against the MD5 sum of the original .ISO file using the isoinfo console utility. To begin with, we will extract some primary information about the recorded disc with the command:

Isoinfo -d -i / dev / sr0

Where / dev / sr0 is a DVD-ROM, to clarify the name of your mounted optical disk, if you have more than one, you can find it by the output of this command:

From the information available after entering:

$ isoinfo -d -i / dev / sr0

You will have something like the following:

CD-ROM is in ISO 9660 format System id: Volume id: Lubuntu 12.04 i386 Volume set id: Publisher id: Data preparer id: XORRISO-1.0.8 2011.04.14.073001, LIBISOBURN-1.0.8, LIBISOFS-1.0.8, LIBBURN -1.0.6 Application id: Copyright File id: Abstract File id: Bibliographic File id: Volume set size is: 1 Volume set sequence number is: 1 Logical block size is: 2048 Volume size is: 352406 El Torito VD version 1 found, boot catalog is in sector 320 Joliet with UCS level 3 found Rock Ridge signatures version 1 found Eltorito validation header: Hid 1 Arch 0 (x86) ID "" Key 55 AA Eltorito defaultboot header: Bootid 88 (bootable) Boot media 0 (No Emulation Boot) Load segment 0 Sys type 0 Nsect 4 Bootoff 52A18 338456

These lines are important to us:

Logical block size is: 2048 Volume size is: 352406

Dd if \u003d / dev / sr0 bs \u003d 2048 count \u003d 352406 conv \u003d notrunc, noerror | md5sum -b

Pay attention to three points that you must substitute your own:

  • / dev / sr0 - the path to the optical disk (if you have one, then this item is unchanged)
  • bs \u003d 2048 - you have your own "Logical block size is:"
  • count \u003d 352406 - from the "Volume size is:" value.

After counting, you get something like this:

352406 + 0 records read 352406 + 0 records written copied 721727488 bytes (722 MB) * -, 55.3223 s, 13.0 MB / s

- this is the MD5 sum of the disk. If it matches the value indicated on the site where you downloaded the file or with the original file on your computer, then the disc was written without errors. In practice, it happens that the MD5 amount often does not coincide with the MD5 amount indicated on the site due to disk reading errors.

Checking download correctness file from the archive using Total Commander

"Total Commander" is a multifunctional analogue of "Explorer" in Windows; checking md5 sums is just built in as an optional feature. Of course, it makes no sense to install such a large program especially for checking md5-sums. But if you already have it, you can use the opportunity with its help to check the correctness of the file download.

1. Open the directory with the file to be checked and the reference md5 sum to it in the Total Commander window and left-click the required md5 file (in this case, it is the only one):

2. From the Files menu select "Verify CRC Checksums":

3. Wait for the end of the verification process:

4. Now, if in the report window you will see "OK" to the left of your file name

It means that everything is in order and the file has downloaded correctly. If the report looks something like this:

This means that the file is damaged and you will have to download it again.

Attention! Total Commander creates checksums in its own format, they can only be verified by itself. Therefore, try not to use this program to create checksums if you are not sure that those who will check the correctness of the download have Total Commander installed.

1. Open the directory with the required file / files in the Total Commander window:

2. Select the required files:

A checksum is a digit or string that is calculated by summing all the digits of the required data. It can be used later to detect errors in the checked data during storage or transmission. Then the checksum is recalculated again and the resulting value is compared with the previous one.

In this short article, we will look at what a Linux checksum is, as well as how to check the integrity of files using md5 checksums.

Linux MD5 (Message Digest 5) checksums can be used to check the integrity of strings or files. MD5 sum is a 128 bit string that consists of letters and numbers. The essence of the MD5 algorithm is that a 128-bit hash will be generated for a specific file or line, and it will be the same on all machines if the files are identical. It is difficult to find two different files that produce the same hashes.

On Linux, the md5sum utility is used to calculate checksums using the md5 algorithm. You can use it to check the integrity of iso images or other files downloaded from the Internet.

This utility allows not only calculating linux checksums, but also checking compliance. It comes as a standard GNU utility, so you don't need to install anything.

Checking checksums in Linux

The syntax for the md5sum command is very simple:

$ md5sum options file

There are only a few options and, considering the tasks of the utility, they are quite enough:

  • -c - check the checksums file;
  • -b - work in binary format;
  • -t - work in text format;
  • -w - display warnings about incorrectly formatted amounts file;
  • --quiet - do not display messages about successful checks.

First, copy the / etc / group file to your home folder to experiment a little with:

cp / etc / group groups

For example, let's calculate the checksum for the / etc / group file:

md5sum groups\u003e groups.md5

Then modify this file in some way, for example, remove the first line and calculate the checksums again:


As you can see, the value is now different, which means that the contents of the file have changed too. Then put back the first line of root: x: 0: and copy this file to groups_list and

cp groups groups_list

Then the linux checksum must be checked again:

md5sum groups_list

The amount matches the first option, even though the file has been renamed. Note that md5sum only works with the contents of files, it is not interested in either its name or its attributes. You can verify that both files have the same amounts:

md5sum groups groups_list

You can redirect the output of this command to a file so that you can check the checksums later:

md5sum groups groups_list\u003e groups.md5

To check if the files have changed since the checksum was generated use the option -c or --check... If all is well, the word will appear next to each file name OKor PURPOSE:

md5sum -c groups.md5

But now you cannot rename files, because when checking the utility will try to open them by name and, naturally, you will get an error. It works the same way for strings:

echo -n "Losst" | md5sum -
$ echo -n "Losst Q&A" | md5sum -

conclusions

In this article, you learned how to get and check the linux checksum for files and lines. While vulnerabilities have been found in the MD5 algorithm, it is still useful, especially if you trust a tool that will generate hashes.

Checking the integrity of Linux files is a very important aspect of using the system. The Linux file checksum is used not only manually when checking downloaded files, but also in many system programs, for example, in the package manager. If you have any questions, ask in the comments!

A short video to complete

MD5 or Message Digest 5 is a 128-bit hashing algorithm developed in the early 90's by Professor Ronald Rivest. Typically represented as a sequence of 32 hexadecimal digits, for example: In order to understand what MD5 is, you first need to understand the concept of hashing.

Hashing is the process of converting any array of data into a fixed-length output string. This transformation is carried out using so-called hash functions. Such a function receives an array of data at the input, and at the output it returns the so-called hash (hash-sum) - a unique string of fixed length.

The hash function algorithm is built in such a way that the function produces a unique string for any data array. Thanks to this feature, the resulting string can be used as a digital fingerprint of the data. This fingerprint can be used to verify the integrity of the data.

For example, when a software developer publishes his software product on the network, he can publish its hash with him. This will allow users to check the integrity of the program before installing it. If the program was infected with viruses or loaded with errors, its hash will not match the hash that was published by the program developer.

History of MD5 development

The MD5 algorithm was developed by Professor Ronald L. Rivest of the Massachusetts Institute of Technology in 1991. This algorithm replaced the previous version of the MD4 algorithm. Since that time, the algorithm has gained great popularity and began to be used everywhere.

Since 1993, studies have appeared regularly that discover new vulnerabilities in the MD5 algorithm. At the moment, the MD5 algorithm is considered vulnerable and is gradually being replaced by the SHA algorithm.

How to get MD5 hash

If you need to get an MD5 hash from a regular line of text, then the most convenient way is to use online services. One of these services is.

In order to get an MD5 hash using this service, just enter a string in the field and click on the "Hash" button. The hash of the entered string will appear in this field.

If you need to get the MD5 hash of a file, then you have to use special programs, for example, MD5summer ().

It is very easy to work with this program. In order to get the MD5 hash of a file, just run the program and select the desired file.