For a
cryptographic hash function
A cryptographic hash function (CHF) is a hash algorithm (a map of an arbitrary binary string to a binary string with fixed size of n bits) that has special properties desirable for cryptography:
* the probability of a particular n-bit output re ...
(a mathematical
algorithm
In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algorithms are used as specificat ...
), a MASH-1 (Modular Arithmetic Secure Hash) is a
hash function based on
modular arithmetic
In mathematics, modular arithmetic is a system of arithmetic for integers, where numbers "wrap around" when reaching a certain value, called the modulus. The modern approach to modular arithmetic was developed by Carl Friedrich Gauss in his book ...
.
History
Despite many proposals, few hash functions based on modular arithmetic have withstood attack, and most that have tend to be relatively inefficient. MASH-1 evolved from a long line of related proposals successively broken and repaired.
Standard
Committee Draft ISO/IEC 10118-4 (Nov 95)
Description
MASH-1 involves use of an
RSA-like modulus
, whose bitlength affects the security.
is a product of two
prime number
A prime number (or a prime) is a natural number greater than 1 that is not a product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime because the only ways ...
s and should be difficult to
factor, and for
of unknown factorization, the security is based in part on the difficulty of extracting modular roots.
Let
be the length of a message block in
bit.
is chosen to have a binary representation a few bits longer than
, typically
.
The message is padded by appending the message length and is separated into blocks
of length
. From each of these blocks
, an enlarged block
of length
is created by placing four bits from
in the lower half of each byte and four bits of value 1 in the higher half. These blocks are processed iteratively by a compression function:
:
:
Where
and
.
denotes the
bitwise OR and
the
bitwise XOR.
From
are now calculated more data blocks
by linear operations (where
denotes concatenation):
:
:
:
These data blocks are now enlarged to
like above, and with these the compression process continues with eight more steps:
:
Finally the hash value is
, where
is a prime number with
.
Smashing MASH-1, Vladimir Antipkin
/ref>
MASH-2
There is a newer version of the algorithm called MASH-2 with a different exponent. The original is replaced by . This is the only difference between these versions.
References
* A. Menezes, P. van Oorschot, S. Vanstone, ''Handbook of Applied Cryptography'',
{{cryptography navbox, hash
Cryptographic hash functions