Back in time the _CIPHER MI instruction was the only immediately available function to produce an MD5 (Message Digest) or SHA-1 (Secure Hash Algorithm) hash value. Now that the SHA-1 algorithm has been deprecated, it appears that the _CIPHER MI instruction does not support the SHA-256 hash algorithm.
IBM probably decided to focus their effort on the more recent Calculate Hash (Qc3CalculateHash) API.
As documented, the Qc3CalculateHash API supports the MD5 as well as SHA-1 to SHA-512 hash algorithms, and will probably continue to be enhanced, if and when new algorithms are implemented. I have written a very simple Calculate Hash Value (CLCHASHVAL) command for the purpose of demonstrating how to call he Qc3CalculateHash API. The command processing program could easily be adapted to more specific requirements, given the need.
The Calculate Hash Value command is based on the following source members:
CBX277 RPGLE Calculate Hash Value - CPP CBX277S RPGLE Encrypt and Decrypt Data - services CBX277B SRVSRC Encrypt and Decrypt Data - services CBX277H PNLGRP Calculate Hash Value - Help CBX277X CMD Calculate Hash Value CBX277M CLP Calculate Hash Value - Build command
Compiling and running the CL-program CBX277M will create the utility for you, once you’ve copied the other source members to their respective default source files. The source members are located in the zip file ClcHashVal.zip available here:
Postscript: I have added the Calculate File Hash Value (CLCFILHASH) command to the download zip-file. The CLCFILHASH command is similar to the CLCHASHVAL command, but will produce the hash value based on the content of a specified input stream file name. You’ll find compilation instructions in each of the respective source file headers:
CBX2772 RPGLE Calculate File Hash Value - CPP CBX2772H PNLGRP Calculate File Hash Value - Help CBX2772X CMD Calculate File Hash Value