# HashFunctions

## Contents

## References

Wikipedia articles

- http://en.wikipedia.org/wiki/List_of_hash_functions
- http://en.wikipedia.org/wiki/Cryptographic_hash_function
- http://en.wikipedia.org/wiki/Data_Encryption_Standard
- http://en.wikipedia.org/wiki/Salt_(cryptography)
- http://en.wikipedia.org/wiki/Cryptographic_nonce

Non-Wikipedia resources

Online Hashers

- http://hashkiller.com/password/
- http://www.hashemall.com/
- http://hash-it.net/
- http://gtools.org/tool/md4-hash-generator/
- http://textop.us/Hashing/Haval

## crypt()

http://en.wikipedia.org/wiki/Crypt_(Unix)

crypt() is a UNIX library function, **not** a hash algorithm. The function generates a hash from a given input (e.g. a password) by using a hash algorithm that can vary between different implementations of crypt(), or depending on a system's configuration. The output of the function is a text string that encodes 3 pieces of information:

- the hash
- the salt
- the hash algorithm used

Hash algorithms used by crypt()

- traditional implementation uses a modified form of the DES algorithm (usenix.org article)
- later implementations modified the original algorithm in various non-standard ways
- another modification of the original algorithm was done by BSDi; hashes generated with this algorithm are identified by starting with
`_` - an algorithm based on (but not equal to) MD5; hashes generated by this algorithm are identified by starting with
`$1$`(usenix.org article) - an algorithm based on (but not equal to) Blowfish; hashes generated by this algorithm are identified by starting with
`$2$`or`$2a$`(depending on the algorithm variant) (usenix.org article) - an algorithm based on (but not equal to) SHA; hashes generated by this algorithm are identified by starting with
`$5$`or`$6$`(depending on the algorithm variant)

## MD2

http://en.wikipedia.org/wiki/MD2_(cryptography)

Wikipedia quote:

Message Digest Algorithm 2 (MD2) is a cryptographic hash function developed by Ronald Rivest in 1989. The algorithm is optimized for 8-bit computers. MD2 is specified in RFC 1319. Although other algorithms have been proposed since, such as MD4, MD5 and SHA, even as of 2004 MD2 remains in use in public key infrastructures as part of certificates generated with MD2 and RSA.

## MD4

http://en.wikipedia.org/wiki/MD4

Wikipedia quote:

MD4 is a message digest algorithm (the fourth in a series) designed by Professor Ronald Rivest of MIT in 1990. It implements a cryptographic hash function for use in message integrity checks. The digest length is 128 bits. The algorithm has influenced later designs, such as the MD5, SHA and RIPEMD algorithms. MD4 is also used to compute NT-hash password digests on Microsoft Windows NT, XP and Vista.

## MD5

http://en.wikipedia.org/wiki/MD5

Wikipedia quote:

In cryptography, MD5 (Message-Digest algorithm 5) is a widely used, partially insecure[1] cryptographic hash function with a 128-bit hash value. As an Internet standard (RFC 1321), MD5 has been employed in a wide variety of security applications, and is also commonly used to check the integrity of files. An MD5 hash is typically expressed as a 32 digit hexadecimal number.

## SHA

http://en.wikipedia.org/wiki/SHA_hash_functions

Wikipedia quote:

The SHA hash functions are a set of cryptographic hash functions designed by the National Security Agency (NSA) and published by the NIST as a U.S. Federal Information Processing Standard. SHA stands for Secure Hash Algorithm. The five algorithms are denoted SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512. The latter four variants are sometimes collectively referred to as SHA-2. SHA-1 produces a message digest that is 160 bits long; the number in the other four algorithms' names denote the bit length of the digest they produce.

## RIPEMD

http://en.wikipedia.org/wiki/RIPEMD

Wikipedia quote:

RIPEMD-160 (RACE Integrity Primitives Evaluation Message Digest) is a 160-bit message digest algorithm (and cryptographic hash function) developed in Leuven (Belgium) by Hans Dobbertin, Antoon Bosselaers and Bart Preneel at the COSIC research group at the Katholieke Universiteit Leuven, and first published in 1996. It is an improved version of RIPEMD, which in turn was based upon the design principles used in MD4, and is similar in performance to the more popular SHA-1.

There also exist 128, 256 and 320-bit versions of this algorithm, called RIPEMD-128, RIPEMD-256, and RIPEMD-320, respectively. The 128-bit version was intended only as a drop-in replacement for the original RIPEMD, which was also 128-bit, and which had been found to have questionable security. The 256 and 320-bit versions diminish only the chance of accidental collision, and don't have higher levels of security as compared to, respectively, RIPEMD-128 and RIPEMD-160.

## HAVAL

http://en.wikipedia.org/wiki/HAVAL

Wikipedia quote:

HAVAL is a cryptographic hash function. Unlike MD5, but like most modern cryptographic hash functions, HAVAL can produce hashes of different lengths. HAVAL can produce hashes in lengths of 128 bits, 160 bits, 192 bits, 224 bits, and 256 bits. HAVAL also allows users to specify the number of rounds (3, 4, or 5) to be used to generate the hash.

## WHIRLPOOL

http://en.wikipedia.org/wiki/Whirlpool_(cryptography)

Wikipedia quote:

Whirlpool (sometimes styled WHIRLPOOL) is a cryptographic hash function designed by Vincent Rijmen (co-creator of the Advanced Encryption Standard) and Paulo S. L. M. Barreto. The hash has been recommended by the NESSIE project. It has also been adopted by the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC) as part of the joint ISO/IEC 10118-3 international standard.

## Tiger

http://en.wikipedia.org/wiki/Tiger_(cryptography)

Wikipedia quote:

In cryptography, Tiger is a cryptographic hash function designed by Ross Anderson and Eli Biham in 1995 for efficiency on 64-bit platforms. The size of a Tiger hash value is 192 bits. Truncated versions (known as Tiger/128 and Tiger/160) can be used for compatibility with protocols assuming a particular hash size. Unlike the SHA-2 family, no distinguishing initialization values are defined; they are simply prefixes of the full Tiger/192 hash value.

Tiger2 is a variant of Tiger which uses the same message-end padding as MD5 and SHA, rather than the slightly different padding used in MD4. It is otherwise identical. A formal specification of Tiger2 has not yet been released, but test vectors are available.

## Snefru

http://en.wikipedia.org/wiki/Snefru

Wikipedia quote:

Snefru is a cryptographic hash function invented by Ralph Merkle which supports 128-bit and 256-bit output.

## GOST

http://en.wikipedia.org/wiki/GOST_(hash_function)

Wikipedia quote:

The GOST hash function, defined in the standards GOST R 34.11-94 and GOST 34.311-95, is a 256-bit cryptographic hash function.

## HAS-160

http://en.wikipedia.org/wiki/HAS-160

Wikipedia quote:

HAS-160 is a cryptographic hash function designed for use with the Korean KCDSA digital signature algorithm. It derives from SHA-1, with assorted changes intended to increase its security. It produces a 160-bit output.

## MDC-2

http://en.wikipedia.org/wiki/MDC-2

Wikipedia quote:

In cryptography, MDC-2 (Modification Detection Code 2, sometimes called Meyer-Schilling) is a cryptographic hash function with a 128-bit hash value.

## N-Hash

http://en.wikipedia.org/wiki/N-Hash

Wikipedia quote:

In cryptography, N-Hash is a cryptographic hash function based on the FEAL round function, and is now considered insecure. It was proposed in 1990 by Miyaguchi et al; weaknesses were published the following year.

N-Hash has a 128-bit hash size.

## RadioGatún

http://en.wikipedia.org/wiki/RadioGat%C3%BAn

Wikipedia quote:

Panama is a cryptography primitive which can be used both as a hash function and a stream cipher. [...]

Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles Van Assche proposed, at NIST's 2006 Second Cryptographic Hash Workshop, unveiled a Panama variant called RadioGatún. RadioGatún is strictly a hash function; it does not have the known weaknesses that Panama's hash function has.

## HAS-V

http://en.wikipedia.org/wiki/HAS-V

Wikipedia quote:

In cryptography, HAS-V is a cryptographic hash function with a variable output length. HAS-V is a hash function based on a block cipher. The hash function can produce hash values with lengths from 16 to 40 bytes.

## MASH

http://en.wikipedia.org/wiki/MASH-1

Wikipedia quote:

MASH-1 is a hash function based on modular arithmetic. [...]

There is a new version of the algorithm called MASH-2 with a different exponent (e=2).

## Application specific hash algorithms

`htpasswd`

http://httpd.apache.org/docs/trunk/misc/password_encryptions.html

Apache's `htpasswd` uses a special variant of MD5. Hashes generated with this algorithm are identified by starting with `$apr1$`.

### MySQL

http://dev.mysql.com/doc/refman/6.0/en/encryption-functions.html http://dev.mysql.com/doc/refman/6.0/en/password-hashing.html

MySQL's PASSWORD() function generates hashes specifically intended for the authentication system in MySQL Server. These hashes are placed in the "Password" column of the "user" grant table. I have not (yet) researched any particulars about the algorithm used for generating the hash.

### LAN Manager

http://en.wikipedia.org/wiki/LM_hash

Wikipedia quote:

LM hash or LAN Manager hash is one of the formats that Microsoft LAN Manager and Microsoft Windows versions previous to Windows Vista use to store user passwords that are fewer than 15 characters long. This type of hash is the only type of encryption used in Microsoft LAN Manager, hence the name, and versions of Windows up to Windows Me. It is also supported in more recent Windows versions for backward compatibility, although in Windows Vista must be manually enabled for use.