Problem:
Micro Focus products do not contain any built-in support for MD5 hashing, but it can still be used programmatically.
There are no library routines within Net Express to implement MD5 hashing directly. If you search google for MD5 and COBOL and there are a number of links. One of these suggests using C to access the MD5 as it is easier than in COBOL. If so then consider using C and compiling/linking this to a DLL.
You can then access this from COBOL via CALL statements.
Resolution:
BUILD W/RELEASE: Net Express v4.0 with ALL07N40
============
INTRODUCTION
==========
We've seen a number of requests for a COBOL implementation of the popular cryptographic hash function MD5. MD5 is widely used for file checksums and similar purposes. It's also widely used for digital signature hashes and message authentication codes, though due to recent successful attacks it's no longer preferred for those purposes. It's still useful for many purposes, though.
The MD5 algorithm is freely available and legally unencumbered, and a COBOL implementation was created based (loosely) on the reference C implementation in RFC 1321. It is attached in the form of a sample program that reads a file and displays the MD5 hash of its contents. The program was tested on Windows and AIX.
Note, however, that this is unsupported sample code.
Note also that this program is written using MF COBOL extensions and is not portable COBOL. MD5 requires a lot of bit-fiddling and modular arithmetic, for which portable COBOL is ill-suited.
SOURCE FILES:
=========
Program Files Description
-------------------- -----------------------------------------------------------
COBMD5.CBL Computes MD5 hash of a file's contents
Copy Files:
-------------------- -----------------------------------------------------------
COBMD5.TXT Test input for COBMD5
REQUIREMENTS:
==========
To test this program using the Net Express provided project you need to ensure that the command line setting is set to COBMD5.TXT. This can be done by pulling down the Animate menu choose settings and fill the appropriate parameter.
To test from a command line add the file name parameter after the name of the program, for example;
COBMD5.EXE COBMD5.TXT
The output should be:
c36fbf21a1e2cb18e73bd3707555df4c
Note that if you transfer COBMD5.TXT to a Unix system for testing, you must transfer it in binary mode to get the correct output.
OPERATION:
========
REFERENCES:
========
NOTE:
====
==========================================================
Keywords: demonstration, sample, example, demo, cobmd5.zip
demo.ex
demo.me
demo.ne
demo.se