AmendHub

Download

plus

/

MD5

/

README

 

(View History)

mrw   Initial commit. Latest amendment: 1 on 2024-10-15

1 ** MD5 **
2
3 A library that implements the MD5 interface described in RFC 1321
4
5 https://www.ietf.org/rfc/rfc1321.txt
6
7 Developed by mrw <plus@m0001a.org>
8
9 ** INTERFACE **
10
11 MD5_CTX
12 An opaque object that maintains an MD5 digest.
13
14 MD5Init(MD5_CTX *ctx)
15 Initialize an MD5 calculation.
16
17 MD5Update(MD5_CTX *ctx, unsigned char *input, int inputLen)
18 Add input of length inputLen to the ongoing MD5
19 calculation held in ctx.
20
21 MD5Final(unsigned char digest[16], MD5_CTX *ctx);
22 Store the completed MD5 of ctx into digest, and clear all
23 state in ctx.
24
25 ** NOTES **
26
27 The source code has been programatically extracted from RFC 1321 with
28 three changes:
29
30 1. In md5c.c, the PADDING global variable initialization can be
31 delayed to InitLibP for use in early THINK Pascal versions.
32 See below for details.
33
34 2. In mddriver.c, main() use's THINK C's ccommand function to
35 retrieve command line arguments and configure inputs.
36
37 3. Also in mddriver.c, the MDString function takes an expected digest
38 so it can print a message when the calculated one differs. This
39 causes MDTestSuite to mention when a digest case fails.
40
41 ** HOW TO USE **
42
43 This repository contains two THINK C 5.0 projects:
44
45 MD5.π
46 Builds md5c.c and exposes the main function of RFC 1321
47 mddriver.c
48
49 MD5Lib.π
50 Builds md5pascal.c, which defines Pascal wrappers
51 MD5InitP, MD5UpateP, and MD5FinalP. See also InitLibP below.
52
53 You can reuse this code in several ways:
54
55 1. Include "md5c.c" in your THINK C projects. Don't forget to bring
56 along and include "global.h" and "md5.h". They've been tested
57 with THINK C 3 and THINK C 5.
58
59 2. Add "MD5.π" to your THINK C 5 projects. The linker will extract
60 only the compiled code you use. The THINK C 5 manual recommends
61 this.
62
63 3. Use "MD5Lib.π" to build and "MD5.lib" you can use in your THINK
64 Pascal projects. Use the MD5 unit defined in "MD5.p".
65 Note that THINK Pascal versions before 4 do not
66 load global variables; for these versions, make to define
67 _MD5_EXPLICIT_INIT, and call InitLibP exactly once in your program.
68 For THINK Pascal 4, you should not define _MD5_EXPLICIT_INIT or
69 call InitLibP.
70
71 ** LICENSES **
72
73 See the license in md5c.c for the original RSA license that covers
74 md5c.c, md5.h, and global.h. The LICENSE file covers everything else.
75
76 ** CHANGELOG **
77
78 1.0 - 2024-10-15
79 - Initial implementation.