The md5 Reference Manual

This is the md5 Reference Manual, version 2.0.4, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 17:18:20 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 md5

The MD5 Message-Digest Algorithm RFC 1321

Maintainer

Pierre R. Mai <>

Author

Pierre R. Mai <>

License

Public Domain

Version

2.0.4

Dependency

sb-rotate-byte (system).

Source

md5.asd.

Child Component

md5.lisp (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 md5/md5.asd

Source

md5.asd.

Parent Component

md5 (system).

ASDF Systems

md5.


3.1.2 md5/md5.lisp

Source

md5.asd.

Parent Component

md5 (system).

Packages

md5.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 md5

Source

md5.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Ordinary functions

Function: fill-block (block buffer offset)

Convert a complete 64 byte input vector segment into the given 16 word MD5 block. This currently works on (unsigned-byte 8) and character simple-arrays, via the functions ‘fill-block-ub8’ and ‘fill-block-char’ respectively. Note that it will not work correctly on character simple-arrays if ‘char-code-limit’ is greater than 256.

Package

md5.

Source

md5.lisp.

Function: fill-block-char (block buffer offset)

DEPRECATED: Convert a complete 64 character input string segment starting from ‘offset’ into the given 16 word MD5 block.

Package

md5.

Source

md5.lisp.

Function: fill-block-ub8 (block buffer offset)

Convert a complete 64 (unsigned-byte 8) input vector segment starting from ‘offset’ into the given 16 word MD5 block.

Package

md5.

Source

md5.lisp.

Function: finalize-md5-state (state)

If the given md5-state has not already been finalized, finalize it, by processing any remaining input in its buffer, with suitable padding and appended bit-length, as specified by the MD5 standard.

The resulting MD5 message-digest is returned as an array of sixteen (unsigned-byte 8) values. Calling ‘update-md5-state’ after a call to ‘finalize-md5-state’ results in unspecified behaviour.

Package

md5.

Source

md5.lisp.

Function: initial-md5-regs ()

Create the initial working state of an MD5 run.

Package

md5.

Source

md5.lisp.

Function: make-md5-state ()
Package

md5.

Source

md5.lisp.

Function: md5-state-p (object)
Package

md5.

Source

md5.lisp.

Function: md5regs-digest (regs)

Create the final 16 byte message-digest from the MD5 working state in ‘regs’. Returns a (simple-array (unsigned-byte 8) (16)).

Package

md5.

Source

md5.lisp.

Function: md5sum-file (pathname)

Calculate the MD5 message-digest of the file specified by ‘pathname’.

Package

md5.

Source

md5.lisp.

Function: md5sum-sequence (sequence &key start end)

Calculate the MD5 message-digest of data in ‘sequence’, which should be a 1d simple-array with element type (unsigned-byte 8). On CMU CL and SBCL non-simple and non-1d arrays with this element-type are also supported. Use with strings is DEPRECATED, since this will not work correctly on implementations with ‘char-code-limit’ > 256 and ignores character-coding issues. Use md5sum-string instead, or convert to the required (unsigned-byte 8) format through other means before-hand.

Package

md5.

Source

md5.lisp.

Function: md5sum-stream (stream)

Calculate an MD5 message-digest of the contents of ‘stream’. Its element-type has to be (unsigned-byte 8). Use on character streams is DEPRECATED, as this will not work correctly on implementations with ‘char-code-limit’ > 256 and ignores character coding issues.

Package

md5.

Source

md5.lisp.

Function: md5sum-string (string &key external-format start end)

Calculate the MD5 message-digest of the binary representation of ‘string’ (as octets) in the external format specified by ‘external-format’. The boundaries ‘start’ and ‘end’ refer to character positions in the string, not to octets in the resulting binary representation. The permissible external format specifiers are determined by the underlying implementation.

Package

md5.

Source

md5.lisp.

Function: update-md5-block (regs block)

This is the core part of the MD5 algorithm. It takes a complete 16 word block of input, and updates the working state in A, B, C, and D accordingly.

Package

md5.

Source

md5.lisp.

Function: update-md5-state (state sequence &key start end)

Update the given md5-state from ‘sequence’, which is either a simple-string or a simple-array with element-type (unsigned-byte 8), bounded by ‘start’ and ‘end’, which must be numeric bounding-indices. Note that usage on simple-strings is DEPRECATED, since this will not work correctly if ‘char-code-limit’ is more than 256. String input should be converted to (unsigned-byte 8) simple-arrays with external-format conversion routines beforehand.

Package

md5.

Source

md5.lisp.


5.1.2 Structures

Structure: md5-state
Package

md5.

Source

md5.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: regs
Type

md5:md5-regs

Initform

(md5:initial-md5-regs)

Readers

md5-state-regs.

Writers

This slot is read-only.

Slot: amount
Type

(integer 0 *)

Initform

0

Readers

md5-state-amount.

Writers

(setf md5-state-amount).

Slot: block
Package

common-lisp.

Type

md5::md5-block

Initform

(md5::make-ub32-vector 16)

Readers

md5-state-block.

Writers

This slot is read-only.

Slot: buffer
Type

(simple-array (unsigned-byte 8) (64))

Initform

(make-array 64 :element-type (quote (unsigned-byte 8)))

Readers

md5-state-buffer.

Writers

This slot is read-only.

Slot: buffer-index
Type

(integer 0 63)

Initform

0

Readers

md5-state-buffer-index.

Writers

(setf md5-state-buffer-index).

Slot: finalized-p
Readers

md5-state-finalized-p.

Writers

(setf md5-state-finalized-p).


5.1.3 Types

Type: md5-regs ()

The working state of the MD5 algorithm, which contains the 4 32-bit registers A, B, C and D.

Package

md5.

Source

md5.lisp.


5.2 Internals


5.2.1 Constants

Constant: +buffer-size+

Size of internal buffer to use for ‘md5sum-stream’ and ‘md5sum-file’ operations. This should be a multiple of 64, the MD5 block size.

Package

md5.

Source

md5.lisp.

Constant: +md5-magic-a+

Initial value of Register A of the MD5 working state.

Package

md5.

Source

md5.lisp.

Constant: +md5-magic-b+

Initial value of Register B of the MD5 working state.

Package

md5.

Source

md5.lisp.

Constant: +md5-magic-c+

Initial value of Register C of the MD5 working state.

Package

md5.

Source

md5.lisp.

Constant: +md5-magic-d+

Initial value of Register D of the MD5 working state.

Package

md5.

Source

md5.lisp.


5.2.2 Special variables

Special Variable: *t*
Package

md5.

Source

md5.lisp.


5.2.3 Macros

Macro: assemble-ub32 (a b c d)

Assemble an ub32 value from the given (unsigned-byte 8) values, where a is the intended low-order byte and d the high-order byte.

Package

md5.

Source

md5.lisp.

Macro: make-ub32-vector (length &rest args)
Package

md5.

Source

md5.lisp.

Macro: md5-regs-a (regs)
Package

md5.

Source

md5.lisp.

Macro: md5-regs-b (regs)
Package

md5.

Source

md5.lisp.

Macro: md5-regs-c (regs)
Package

md5.

Source

md5.lisp.

Macro: md5-regs-d (regs)
Package

md5.

Source

md5.lisp.

Macro: ub32-aref (vector index)
Package

md5.

Source

md5.lisp.

Macro: with-md5-round ((op block) &rest clauses)
Package

md5.

Source

md5.lisp.


5.2.4 Compiler macros

Compiler Macro: mod32+ (a b)
Package

md5.

Source

md5.lisp.


5.2.5 Ordinary functions

Function: copy-md5-state (instance)
Package

md5.

Source

md5.lisp.

Function: copy-to-buffer (from from-offset count buffer buffer-offset)

Copy a partial segment from input vector ‘from’ starting at ‘from-offset’ and copying ‘count’ elements into the 64 byte buffer starting at ‘buffer-offset’.

Package

md5.

Source

md5.lisp.

Function: f (x y z)
Package

md5.

Source

md5.lisp.

Function: g (x y z)
Package

md5.

Source

md5.lisp.

Function: h (x y z)
Package

md5.

Source

md5.lisp.

Function: i (x y z)
Package

md5.

Source

md5.lisp.

Reader: md5-state-amount (instance)
Writer: (setf md5-state-amount) (instance)
Package

md5.

Source

md5.lisp.

Target Slot

amount.

Reader: md5-state-block (instance)
Package

md5.

Source

md5.lisp.

Target Slot

block.

Reader: md5-state-buffer (instance)
Package

md5.

Source

md5.lisp.

Target Slot

buffer.

Reader: md5-state-buffer-index (instance)
Writer: (setf md5-state-buffer-index) (instance)
Package

md5.

Source

md5.lisp.

Target Slot

buffer-index.

Reader: md5-state-finalized-p (instance)
Writer: (setf md5-state-finalized-p) (instance)
Package

md5.

Source

md5.lisp.

Target Slot

finalized-p.

Reader: md5-state-regs (instance)
Package

md5.

Source

md5.lisp.

Target Slot

regs.

Function: mod32+ (a b)
Package

md5.

Source

md5.lisp.

Function: rol32 (a s)
Package

md5.

Source

md5.lisp.


5.2.6 Types

Type: buffer-index ()
Package

md5.

Source

md5.lisp.

Type: md5-block ()

The basic 16x32-bit word blocks that MD5 operates on.

Package

md5.

Source

md5.lisp.

Type: ub32 ()

Corresponds to the 32bit quantity word of the MD5 Spec

Package

md5.

Source

md5.lisp.

Type: ub32-vector (length)
Package

md5.

Source

md5.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   C   F   G   H   I   M   R   U   W  
Index Entry  Section

(
(setf md5-state-amount): Private ordinary functions
(setf md5-state-buffer-index): Private ordinary functions
(setf md5-state-finalized-p): Private ordinary functions

A
assemble-ub32: Private macros

C
Compiler Macro, mod32+: Private compiler macros
copy-md5-state: Private ordinary functions
copy-to-buffer: Private ordinary functions

F
f: Private ordinary functions
fill-block: Public ordinary functions
fill-block-char: Public ordinary functions
fill-block-ub8: Public ordinary functions
finalize-md5-state: Public ordinary functions
Function, (setf md5-state-amount): Private ordinary functions
Function, (setf md5-state-buffer-index): Private ordinary functions
Function, (setf md5-state-finalized-p): Private ordinary functions
Function, copy-md5-state: Private ordinary functions
Function, copy-to-buffer: Private ordinary functions
Function, f: Private ordinary functions
Function, fill-block: Public ordinary functions
Function, fill-block-char: Public ordinary functions
Function, fill-block-ub8: Public ordinary functions
Function, finalize-md5-state: Public ordinary functions
Function, g: Private ordinary functions
Function, h: Private ordinary functions
Function, i: Private ordinary functions
Function, initial-md5-regs: Public ordinary functions
Function, make-md5-state: Public ordinary functions
Function, md5-state-amount: Private ordinary functions
Function, md5-state-block: Private ordinary functions
Function, md5-state-buffer: Private ordinary functions
Function, md5-state-buffer-index: Private ordinary functions
Function, md5-state-finalized-p: Private ordinary functions
Function, md5-state-p: Public ordinary functions
Function, md5-state-regs: Private ordinary functions
Function, md5regs-digest: Public ordinary functions
Function, md5sum-file: Public ordinary functions
Function, md5sum-sequence: Public ordinary functions
Function, md5sum-stream: Public ordinary functions
Function, md5sum-string: Public ordinary functions
Function, mod32+: Private ordinary functions
Function, rol32: Private ordinary functions
Function, update-md5-block: Public ordinary functions
Function, update-md5-state: Public ordinary functions

G
g: Private ordinary functions

H
h: Private ordinary functions

I
i: Private ordinary functions
initial-md5-regs: Public ordinary functions

M
Macro, assemble-ub32: Private macros
Macro, make-ub32-vector: Private macros
Macro, md5-regs-a: Private macros
Macro, md5-regs-b: Private macros
Macro, md5-regs-c: Private macros
Macro, md5-regs-d: Private macros
Macro, ub32-aref: Private macros
Macro, with-md5-round: Private macros
make-md5-state: Public ordinary functions
make-ub32-vector: Private macros
md5-regs-a: Private macros
md5-regs-b: Private macros
md5-regs-c: Private macros
md5-regs-d: Private macros
md5-state-amount: Private ordinary functions
md5-state-block: Private ordinary functions
md5-state-buffer: Private ordinary functions
md5-state-buffer-index: Private ordinary functions
md5-state-finalized-p: Private ordinary functions
md5-state-p: Public ordinary functions
md5-state-regs: Private ordinary functions
md5regs-digest: Public ordinary functions
md5sum-file: Public ordinary functions
md5sum-sequence: Public ordinary functions
md5sum-stream: Public ordinary functions
md5sum-string: Public ordinary functions
mod32+: Private compiler macros
mod32+: Private ordinary functions

R
rol32: Private ordinary functions

U
ub32-aref: Private macros
update-md5-block: Public ordinary functions
update-md5-state: Public ordinary functions

W
with-md5-round: Private macros