In
cryptography
Cryptography, or cryptology (from "hidden, secret"; and ''graphein'', "to write", or ''-logy, -logia'', "study", respectively), is the practice and study of techniques for secure communication in the presence of Adversary (cryptography), ...
, MDC-2 (Modification Detection Code 2, sometimes called Meyer–Schilling, standardized in ISO 10118-2) is a
cryptographic hash function
A cryptographic hash function (CHF) is a hash algorithm (a map (mathematics), map of an arbitrary binary string to a binary string with a fixed size of n bits) that has special properties desirable for a cryptography, cryptographic application: ...
. 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
Let
be a block cipher encryption function with inputs
(plaintext) and
(key), each of length
, calculating a ciphertext of length also
.
For a given message
to hash, the MDC-2 algorithm proceeds as follows. Let
be two different constants of size
. Let
where each
has size
, then the hash
of the message is given by:
*for
to
:
**
**
**
**
**
**
*return
.
Here the
are split in halves
etc., which have the length
.
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
Hexadecimal (also known as base-16 or simply hex) is a Numeral system#Positional systems in detail, positional numeral system that represents numbers using a radix (base) of sixteen. Unlike the decimal system representing numbers using ten symbo ...
numbers.
is chosen as the 8-byte string 5252525252525252 and
is chosen as the 8-byte string 2525252525252525 (written as hexdigits). Additionally, before each iteration the first byte A
of
recalculated as (A
& 0x9f) ^ 0x40 and the first byte B
of
is recalculated as (B
& 0x9f) ^ 0x20.
The following demonstrates a 43-byte
ASCII
ASCII ( ), an acronym for American Standard Code for Information Interchange, is a character encoding standard for representing a particular set of 95 (English language focused) printable character, printable and 33 control character, control c ...
input (which is padded with five zero-bytes so its length is a multiple of the DES block size of 8 bytes) and the corresponding MDC-2 hash:
MDC2("The quick brown fox jumps over the lazy og")
= 000ed54e093d61679aefbeae05bfe33a
Even a small change in the message will (with probability) result in a completely different hash, e.g. changing
d
to
c
:
MDC2("The quick brown fox jumps over the lazy og")
= 775f59f8e51aec29c57ac6ab850d58e8
The hash of the zero-length string is:
MDC2("")
= 52525252525252522525252525252525
Patent issues
MDC-2 was covered by , issued on March 13, 1990 but filed by
IBM
International Business Machines Corporation (using the trademark IBM), nicknamed Big Blue, is an American Multinational corporation, multinational technology company headquartered in Armonk, New York, and present in over 175 countries. It is ...
on August 28, 1987. Because of patent concerns support for MDC-2 has been disabled in
OpenSSL
OpenSSL is a software library for applications that provide secure communications over computer networks against eavesdropping, and identify the party at the other end. It is widely used by Internet servers, including the majority of HTTPS web ...
on most
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
distributions and is not implemented by many other cryptographic libraries. It is implemented in
GPG's libgcrypt.
The patent was due to expire on August 28, 2007, twenty years after the filing date. It actually expired in 2002
[ (Click on "Bibliographic data".)] because IBM did not pay the renewal fee. The Canadian patent was not renewed and no European patent was granted so MDC-2 can now be freely used.
See also
*
One-way compression function
In cryptography, a one-way compression function is a function that transforms two fixed-length inputs into a fixed-length output.Handbook of Applied Cryptography by Alfred J. Menezes, Paul C. van Oorschot, Scott A. Vanstone. Fifth Printing (August ...
Notes
{{Cryptography navbox , hash
Cryptographic hash functions