# h (Hash) command

Calculate hash values for files.

#### Syntax

    h [-scrc{Method}] [-slf[h][s][n]]

Supported methods: CRC32, CRC64, MD5, SHA1, SHA256, SHA384, SHA512, SHA3-256, XXH64, BLAKE2sp. Default method is CRC32.

Optional -slf[h][s][n] switch determines which fields should be displayed: h: hash, s: size, n: file name. By default (without -slf switch) all these fields will be displayed.

#### Examples

    7z h a.txt

calculates CRC32 for a.txt.

    7z h -scrcsha256 a.iso

calculates SHA256 for a.iso.

    7z h -scrcsha256 -slfh -ba a.iso

calculates SHA256 for a.iso and shows only hash value. It doesn't show additional information about 7-zip program and about file size and file name.

    7z h *

calculates CRC32 for all files in current folder and all subfolders.

#### Notes

7-Zip shows the hash value for each file. It also shows the sum of the hash values and a sum that includes all hash values of data and all hash values for filenames.

7-Zip represents the hash value in one of two ways:

- 7-Zip represents the hash value as an integer in hexadecimal format (in uppercase letters), if the hash digest length is less than or equal to 64 bits: CRC32, CRC64 XXH64.
- 7-Zip represents the hash value as a sequence of bytes in hexadecimal format (in lowercase letters), if the hash digest length is greater than 64 bits: MD5, SHA1, SHA256, SHA384, SHA512, SHA3-256, BLAKE2sp.

These two methods of presentation may look similar, but there is actually a difference between them, as there is a difference between big-endian and little-endian encodings. The difference is in the order of the hexadecimal digits in the value shown.

If more than one file is processed, 7-Zip also calculates the arithmetic sum of the calculated hash values. This arithmetic sum does not depend on the order of the files. So you can compare these arithmetic sum values calculated in different folders on different file systems.

The arithmetic sum value is longer than a single hash value. Therefore, the additional hexadecimal digits of the sum value are displayed after the minus sign: example for CRC32: "F461DFE5-0000001D".

#### Switches that can be used with this command

-i (Include)
-m (Method)
-r (Recurse)
-scrc (Set hash method)
-si (use StdIn)
-sns (Store NTFS alternate Streams)
-ssw (Compress shared files)
-x (Exclude)