Some cryptographic hash functions implemented in Lisp

Gene Michael Stover

created Saturday, 2008 April 19
updated Saturday, 2008 April 19

Copyright © 2008 Gene Michael Stover. All rights reserved. Permission to copy, store, & view this document unmodified & in its entirety is granted.


Contents

1 What is this?

Pretend you didn't see this. It's under construction. Come back in a week or so, about 2008 April 26. - gene

Here are implementations in Common Lisp of three cryptographic hash functions: MD4, MD5, & SHA-1.

2 The algorithms

MD4 is defined in RFC 1320 [1].

3 Features

4 Limitations

5 Usage

6 License

7 Obtaining

8 Examples of padded messages

8.1 Empty message

If the message is empty, we add a full 448 bits of Stage 1 padding, followed by 0 as a 64-bit, little-endian number. Table refmap-empty displays this.


Table 1: map of an empty message after padding
offset word 0 (hex) word 1 (hex) word 2 (hex) word 3 (hex)
0 80000000 0 0 0
4 0 0 0 0
8 0 0 0 0
12 0 0 0 0


8.2 Length 1

If the message's length is 1 octet, we add 440 bits of Stage 1 padding, followed by 1 as a 64-bit, little-endian number. Assume the message's single octet is 1. Table 2 displays this.


Table 2: map of an empty message after padding
offset word 0 (hex) word 1 (hex) word 2 (hex) word 3 (hex)
0 01800000 0 0 0
4 0 0 0 0
8 0 0 0 0
12 1 0 0 0


A. Other File Formats

Bibliography

1
R. Rivest.
Rfc 1320: The md4 message-digest algorithm.
available online, April 1992.
ftp://ftp.rfc-editor.org/in-notes/rfc1320.txt.

Gene Michael Stover 2008-04-27