From the course: Symmetric Cryptography Essential Training

Unlock the full course today

Join today to access over 24,100 courses taught by industry experts.

Challenge: Building a hash algorithm

Challenge: Building a hash algorithm

(bright music) - [Instructor] Welcome to the chapter one challenge. This challenge asks you to build a hash algorithm called MyHash, based on the Merkle-Damgard structure, with the provided MyCompression compression function. The Merkle-Damgard diagram here and the compression function each have two inputs, so keep that in mind. For the initialization vector, use the 64-bit value that I generated randomly and which is set up as a constant variable within the code already. You may need to be careful about the last block if the last part of the plaintext doesn't fill a whole block. The array that you're using won't be conveniently filled with zeros to the right size. Even though it's not a secure practice, fill any empty bytes in the block with zeros. Let's look at the code. The skeleton C++ code I provided here tests the function with a short string, but your code should support all inputs, not just what's here in the main. There's also some commented-out code in there that opens a…

Contents