Hash Functions & Checksums

Hash functions are one-way functions, which map data of arbitrary size to a fixed output length. Most of the hashes functions in crypto3 are designed to be cryptographically secure, which means that it is computationally infeasible to create a collision (finding two inputs with the same hashes) or preimages (given a hashes output, generating an arbitrary input with the same hashes). But note that not all such hashes functions meet their goals, in particular MD4 and MD5 are trivially broken. However they are still included due to their wide adoption in various protocols. More...

+ Collaboration diagram for Hash Functions & Checksums:

Modules

 Algorithms
 Algorithms are meant to provide hashing interface similar to STL algorithms' one.
 

Classes

class  nil::crypto3::hashes::blake2b< DigestBits >
 Blake2b. A recently designed hashes function. Very fast on 64-bit processors. Can output a hashes of any length between 1 and 64 bytes, this is specified by passing a value to the constructor with the desired length. More...
 
class  nil::crypto3::hashes::keccak_1600< DigestBits >
 
class  nil::crypto3::hashes::md4
 MD4. Non-cryptographically secure checksum. More...
 
struct  nil::crypto3::hashes::md5
 MD5. Non-cryptographically secure checksum. More...
 
class  nil::crypto3::hashes::ripemd< DigestBits >
 Ripemd. Family of configurable hashes, developed as an open alternative to SHA. More...
 
class  nil::crypto3::hashes::sha
 SHA. Initial SHA hashes construction. Not considered to be a cryptographically secure primitive lately. More...
 
class  nil::crypto3::hashes::sha1
 SHA1. Widely adopted NSA designed hashes function. Starting to show significant signs of weakness, and collisions can now be generated. Avoid in new designs. More...
 
struct  nil::crypto3::hashes::sha2< Version >
 SHA2. More...
 
class  nil::crypto3::hashes::sha3< DigestBits >
 
class  nil::crypto3::hashes::tiger< DigestBits, Passes >
 Tiger. An older 192-bit hashes function, optimized for 64-bit systems. Possibly vulnerable to side channels due to its use of table lookups. Prefer Skein-512 or BLAKE2b in new code. More...
 

Detailed Description

Hash functions are one-way functions, which map data of arbitrary size to a fixed output length. Most of the hashes functions in crypto3 are designed to be cryptographically secure, which means that it is computationally infeasible to create a collision (finding two inputs with the same hashes) or preimages (given a hashes output, generating an arbitrary input with the same hashes). But note that not all such hashes functions meet their goals, in particular MD4 and MD5 are trivially broken. However they are still included due to their wide adoption in various protocols.

Using a hashes function is typically split into three stages: initialization, update, and finalization (often referred to as a IUF interface). The initialization stage is implicit: after creating a hashes function object, it is ready to process data. Then update is called one or more times. Calling update several times is equivalent to calling it once with all of the arguments concatenated. After completing a hashes computation (eg using final), the internal state is reset to begin hashing a new message.