** MD5 ** A library that implements the MD5 interface described in RFC 1321 https://www.ietf.org/rfc/rfc1321.txt Developed by mrw ** INTERFACE ** MD5_CTX An opaque object that maintains an MD5 digest. MD5Init(MD5_CTX *ctx) Initialize an MD5 calculation. MD5Update(MD5_CTX *ctx, unsigned char *input, int inputLen) Add input of length inputLen to the ongoing MD5 calculation held in ctx. MD5Final(unsigned char digest[16], MD5_CTX *ctx); Store the completed MD5 of ctx into digest, and clear all state in ctx. ** NOTES ** The source code has been programatically extracted from RFC 1321 with three changes: 1. In md5c.c, the PADDING global variable initialization can be delayed to InitLibP for use in early THINK Pascal versions. See below for details. 2. In mddriver.c, main() use's THINK C's ccommand function to retrieve command line arguments and configure inputs. 3. Also in mddriver.c, the MDString function takes an expected digest so it can print a message when the calculated one differs. This causes MDTestSuite to mention when a digest case fails. ** HOW TO USE ** This repository contains two THINK C 5.0 projects: MD5.¹ Builds md5c.c and exposes the main function of RFC 1321 mddriver.c MD5Lib.¹ Builds md5pascal.c, which defines Pascal wrappers MD5InitP, MD5UpateP, and MD5FinalP. See also InitLibP below. You can reuse this code in several ways: 1. Include "md5c.c" in your THINK C projects. Don't forget to bring along and include "global.h" and "md5.h". They've been tested with THINK C 3 and THINK C 5. 2. Add "MD5.¹" to your THINK C 5 projects. The linker will extract only the compiled code you use. The THINK C 5 manual recommends this. 3. Use "MD5Lib.¹" to build and "MD5.lib" you can use in your THINK Pascal projects. Use the MD5 unit defined in "MD5.p". Note that THINK Pascal versions before 4 do not load global variables; for these versions, make to define _MD5_EXPLICIT_INIT, and call InitLibP exactly once in your program. For THINK Pascal 4, you should not define _MD5_EXPLICIT_INIT or call InitLibP. ** LICENSES ** See the license in md5c.c for the original RSA license that covers md5c.c, md5.h, and global.h. The LICENSE file covers everything else. ** CHANGELOG ** 1.0 - 2024-10-15 - Initial implementation.