MDC-2
In cryptography, MDC-2 (Modification Detection Code 2, sometimes called Meyer-Schilling) is a cryptographic hash function. MDC-2 is a hash function based on a block cipher with a proof of security in the ideal-cipher model. The length of the output hash depends on the underlying block cipher used.
Algorithm
For a given message
to hash and a given block cipher encryption function
, the MDC-2 algorithm proceeds as follows. Let
be the block length,
two different constants of size
. If
where each
has size
, then the hash
of the message is given by:
for
to
:
return
MDC-2DES hashes
When MDC-2 uses the DES block cipher, the 128-bit (16-byte) MDC-2 hashes are typically represented as 32-digit hexadecimal numbers. The following demonstrates a 43-byte ASCII input and the corresponding MDC-2 hash:
Even a small change in the message will (with probability) result in a completely different hash, e.g. changing d to c:
The hash of the zero-length string is:
Patent issues
MDC-2 was covered by U.S. Patent 4,908,861, issued on March 13, 1990 but filed by IBM on August 28, 1987.
For this reason, support for MDC-2 has been disabled in OpenSSL on most Linux distributions and is not implemented by many other cryptographic libraries.