RFC 1319 (rfc1319) - Page 2 of 17


The MD2 Message-Digest Algorithm



Alternative Format: Original Text Document



RFC 1319              MD2 Message-Digest Algorithm            April 1992


   are that a textual description of MD2 is included, and that the
   reference implementation of MD2 is more portable.

   For OSI-based applications, MD2's object identifier is

   md2 OBJECT IDENTIFIER ::=
   iso(1) member-body(2) US(840) rsadsi(113549) digestAlgorithm(2) 2}

   In the X.509 type AlgorithmIdentifier [4], the parameters for MD2
   should have type NULL.

2. Terminology and Notation

   In this document, a "byte" is an eight-bit quantity.

   Let x_i denote "x sub i". If the subscript is an expression, we
   surround it in braces, as in x_{i+1}. Similarly, we use ^ for
   superscripts (exponentiation), so that x^i denotes x to the i-th
   power.

   Let X xor Y denote the bit-wise XOR of X and Y.

3. MD2 Algorithm Description

   We begin by supposing that we have a b-byte message as input, and
   that we wish to find its message digest. Here b is an arbitrary
   nonnegative integer; b may be zero, and it may be arbitrarily large.
   We imagine the bytes of the message written down as follows:

                   m_0 m_1 ... m_{b-1}

   The following five steps are performed to compute the message digest
   of the message.

3.1 Step 1. Append Padding Bytes

   The message is "padded" (extended) so that its length (in bytes) is
   congruent to 0, modulo 16. That is, the message is extended so that
   it is a multiple of 16 bytes long. Padding is always performed, even
   if the length of the message is already congruent to 0, modulo 16.

   Padding is performed as follows: "i" bytes of value "i" are appended
   to the message so that the length in bytes of the padded message
   becomes congruent to 0, modulo 16. At least one byte and at most 16
   16 bytes are appended.

   At this point the resulting message (after padding with bytes) has a
   length that is an exact multiple of 16 bytes. Let M[0 ... N-1] denote



Kaliski