IBM Support

How to get the MD5 checksum for a file: md5sum, digest, csum, certUtil (sha1sum)

Question/Answer


Question

When interacting with WebSphere MQ (WMQ) Support regarding a file with an interim fix, you were asked to get the MD5 checksum for the file. You want to know how to get the MD5 checksum.
.
+ Note about IBM Passport Advantage:
When downloading MQ files from IBM Passport Advantage, the download page shows a field named "Checksum". This is NOT based on MD5 but based on SHA1.
The tool to use to compute the checksum is: sha1sum
.

Cause

What is an MD5 checksum?
An MD5 checksum is a 32-character hexadecimal number that is computed on a file.
The MD5 checksum or digest or hash has been widely used in the software world to provide some assurance that a transferred file has arrived intact. For example, file servers often provide a pre-computed MD5, so that a user can compare the checksum of the downloaded file to it
If two files have the same MD5 checksum value, then there is a high probability that the two files are the same.
After downloading an MQ software installation package, you can compute the MD5 checksum on the installation file.

The MD5 checksum or MD5 hash is a more secure alternative to the checksums obtained from the "sum" or "cksum" commands. The sum and cksum commands are file integrity utilities that are based on a weak cyclic redundancy check mechanism (32-bit wide), and this mechanism is prone to high collision rates.

Answer

For illustration purposes, a file from one machine was copied as file "binary.file" into a network shared drive, then the following tests were performed to obtain the MD5 checksum on different platforms.
In all cases the MD5 checksum for this file is: 0c4627e70d168f7f78257e6dd01fdb60

LINUX: md5sum fileName

In Linux, the md5sum utility can be used:
aemtux1:/ % md5sum binary.file
0c4627e70d168f7f78257e6dd01fdb60 binary.file

This utility is provided by the following rpm package (the package name is the key element, because the version number depends on your Linux installation)
% rpm -qf /usr/bin/md5sum
coreutils-5.2.1-23.13


AIX: csum -h MD5 fileName

In AIX, there is no native "md5sum" but the MD5 hash function is provided by csum (provided and supported in AIX 5.3 and later):
csum -h MD5

aemaix1:/ % csum -h MD5 binary.file
0c4627e70d168f7f78257e6dd01fdb60 binary.file

Note: You may need to apply fixes to AIX for csum to handle files larger than 2 GB. For example:
IV03170: csum to support files more than 2GB APPLIES TO AIX 6100-07


Solaris: digest -a md5 -v fileName

In Solaris there is no native "md5sum", but "digest" can be used:

aemsun4:/ % digest -a md5 -v binary.file
md5 (binary.file) = 0c4627e70d168f7f78257e6dd01fdb60


HP-UX: md5sum fileName

HP-UX MD5 Secure Checksum
Product details & specifications
Overview
The HP-UX MD5 Secure Checksum A.01.01.02 bundle (bundle name MD5Checksum) provides a file integrity utility and API based on the standard Message Digest 5 (MD5) algorithm. The MD5Checksum bundle consists of the following two components that can be installed independently:
- HP-UX MD5sum (md5sum checksum command)
- HP-UX LibCryptX (libcryptx libraries providing MD5 APIs)
The md5sum command is based on the MD5 algorithm and generates 128-bit message digests. The md5sum command enables you to verify the integrity of files downloaded over a network connection. You can also use the md5sum command to compare files and verify the integrity of files.


HP NonStop Server (NSS): md5sum fileName

In HP NonStop Server, the md5sum command is available in OSS.


Windows: certUtil -hashfile [pathToFileToCheck] MD5

Newer versions of Windows include a utility called "certUtil".

To create an MD5 for C:\Downloads\binary.file, open a command prompt as administrator and enter:
certUtil -hashfile C:\Downloads\binary.file MD5

This utility can be used to create various SHAs as well.
HashAlgorithm choices: MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512

For more information on this utility see the following technical article from Microsoft:
https://technet.microsoft.com/en-us/library/cc732443(v=ws.11).aspx
CertUtil


Cross reference information
Product Component Platform Version Edition
IBM MQ

Product Alias/Synonym

WMQ MQ MQSeries

Document information

More support for: WebSphere MQ

Component: Install / Migration

Software version: 5.3.1, 6.0, 7.0, 7.1, 7.5, 8.0, 9.0, 9.1

Operating system(s): AIX, HP-UX, Linux, Solaris, Windows

Reference #: 1496703

Modified date: 21 March 2019