Define one type of cryptography or hashing function and desc
Define one type of cryptography or hashing function and describe the security features. Note: There are dozens of different types of cryptographic algorithms - some of which are robust and others which are only meant to make plaintext less easy to understand.Note: Do not post on the same algorithms.
Solution
The ideal cryptographic hash function has four main properties:
->it is quick to compute the hash value for any given message
 ->it is infeasible to generate a message from its hash value except by
 trying all possible messagesa small change to a message should change
 the hash value so extensively that the new hash value appears uncorrelated with the old hash value
 ->it is infeasible to find two different messages with the same hash value
 Cryptographic hash functions have many information-security applications,
 notably in digital signatures, message authentication codes (MACs),
 and other forms of authentication. They can also be used as ordinary
 hash functions, to index data in hash tables, for fingerprinting,
 to detect duplicate data or uniquely identify files, and as checksums
 to detect accidental data corruption. Indeed, in information-security contexts,
 cryptographic hash values are sometimes called (digital) fingerprints, checksums,
 or just hash values,even though all these terms stand for more general functions
 with rather different properties and purposes
 
 Even if a hash function has never been broken, a successful attack against
 a weakened variant may undermine the expert\'s confidence and lead to its abandonment.
 weaknesses were found in several then-popular hash functions, including SHA-0, RIPEMD, and MD5.
 
 To ensure the long-term robustness of applications that use hash functions, there was
 a competition to design a replacement for SHA-2. BLAKE, was optimized
 to produce BLAKE2 which is notable for being faster than SHA-3, SHA-2, SHA-1, or MD5,
 and is used in numerous applications and libraries.
 
 Pseudo code for BLAKE2 algorithm:
 
 Algorithm Blake2b
 Input:
 M Message to be hashed
 cbMessageLen: Number, (0..2128) Length of the message in bytes
 Key Optional 0..64 byte key
 cbKeyLen: Number, (0..64) Length of optional key in bytes
 cbHashLen: Number, (1..64) Desired hash length in bytes
 Output:
 Hash Hash of cbHashLen bytes
Initialize State vector h with IV
 h0 <- 0xcbbb9d5dc1059ed8
 h1 <- 0x629a292a367cd507
 h2 <- 0x9159015a3070dd17
 h3 <- 0x152fecd8f70e5939
 h4 <- 0x67332667ffc00b31
 h5 <- 0x8eb44a8768581511
 h6 <- 0xdb0c2e0d64f98fa7
 h7 <- 0x47b5481dbefa4fa4
Mix key size (cbKeyLen) and desired hash length (cbHashLen) into h0
 h0 <- h0 xor 0x0101kknn
 where kk is Key Length (in bytes)
 nn is Desired Hash Length (in bytes)
Each time we Compress we record how many bytes have been compressed
 cBytesCompressed <- 0
 cBytesRemaining <- cbMessageLen
If there was a key supplied (i.e. cbKeyLen > 0)
 then pad with zeros to make it 128-bytes (i.e. 16 words)
 and prepend it to the message M
 if (cbKeyLen > 0) then
 M <- Pad(Key, 128) || M
 cBytesRemaining <- cBytesRemaining + 128
 end if
Compress whole 128-byte chunks of the message, except the last chunk
 while (cbBytesRemaining > 128) do
 chunk <- get next 128 bytes of message M
 cBytesCompressed <- cBytesCompressed + 128 increase count of bytes that have been compressed
 cBytesRemaining <- cBytesRemaining - 128 decrease count of bytes in M remaining to be processed
Compress(h, chunk, cBytesCompressed, false) false <- this is not the last chunk
 end while
Compress the final bytes from M
 chunk <- get next 128 bytes of message M We will get cBytesRemaining bytes (i.e. 0..128 bytes)
 cBytesCompressed <- cBytesCompressed+cBytesRemaining The actual number of bytes leftover in M
 chunk <- Pad(chunk, 128) If M was empty, then we will still compress a final chunk of zeros
Compress(h, chunk, cBytesCompressed, true) true <- this is the last chunk
Result <- first cbHashLen bytes of little endian state vector h
 End Algorithm Blake2b
 ***************************************************
 Compress function takes a full 128-byte chunk of the input message and mixes it into the ongoing state array:
function Compress
 Input:
 h Persistent state vector
 chunk 128-byte (16 word) chunk of message to compress
 t: Number, 0..2128 Count of bytes that have been fed into the Compression
 IsLastBlock: Boolean Indicates if this is the final round of compression
 Output:
 h Updated persistent state vector
Setup local work vector V
 V0..7 <- h0..7
 V8..15 <- IV0..7
Mix offset 128-bit counter t into V12:V13
 v12 <- V12 xor Lo(t) Lo 64-bits of UInt128 t
 V13 <- V13 xor Hi(t) Hi 64-bits of UInt128 t
   
 If this is the last block then invert all the bits in V14
 if IsLastBlock then
 V14 <- V14 xor 0xFFFFFFFFFFFFFFFF
Treat each 128-byte message chunk as sixteen 8-byte (64-bit) words m
 m0..15 <- chunk
Twelve rounds of cryptographic message mixing
 for i from 0 to 11 do
 Select message mixing schedule for this round.
 Blake2b uses 12 rounds, while SIGMA has only 10 entries.
 S0..15 <- SIGMA[i mod 10] Rounds 10 and 11 use SIGMA[0] and SIGMA[1] respectively
Mix(V0, V4, V8, V12, m[S0], m[S1])
 Mix(V1, V5, V9, V13, m[S2], m[S3])
 Mix(V2, V6, V10, V14, m[S4], m[S5])
 Mix(V3, V7, V11, V15, m[S6], m[S7])
Mix(V0, V5, V10, V15, m[S8], m[S9])
 Mix(V1, V6, V11, V12, m[S10], m[S11])
 Mix(V2, V7, V8, V13, m[S12], m[S13])
 Mix(V3, V4, V9, V14, m[S14], m[S15])
Mix the upper and lower halves of V into ongoing state vector h
 h0..7 <- h0..7 xor V0..7
 h0..7 <- h0..7 xor V8..15
 end for
Result <- h
 End Function Compress



