2 Hash functions

 

This chapter covers

  • Hash functions and their security properties
  • The widely adopted hash functions in use today
  • Other types of hashing that exist

Attributing global unique identifiers to anything, that’s the promise of the first cryptographic construction you’ll learn about in this chapter—the hash function. Hash functions are everywhere in cryptography—everywhere! Informally, they take as input any data you’d like and produce a unique string of bytes in return. Given the same input, the hash function always reproduces the same string of bytes. This might seem like nothing, but this simple fabrication is extremely useful to build many other constructions in cryptography. In this chapter, you will learn everything there is to know about hash functions and why they are so versatile.

2.1 What is a hash function?

In front of you, a download button is taking a good chunk of the page. You can read the letters DOWNLOAD, and clicking this seems to redirect you to a different website containing a file. Below it, lies a long string of unintelligible letters:

f63e68ac0bf052ae923c03f5b12aedc6cca49874c1c9b0ccf3f39b662d1f487b

It is followed by what looks like an acronym of some sort: sha256sum. Sound familiar? You’ve probably downloaded something in your past life that was also accompanied with such an odd string (figure 2.1).

2.2 Security properties of a hash function

2.3 Security considerations for hash functions

2.4 Hash functions in practice

2.4.1 Commitments

2.4.2 Subresource integrity

2.4.3 BitTorrent

2.4.4 Tor

2.5 Standardized hash functions

2.5.1 The SHA-2 hash function

2.5.2 The SHA-3 hash function

2.5.3 SHAKE and cSHAKE: Two extendable output functions (XOF)

2.5.4 Avoid ambiguous hashing with TupleHash

2.6 Hashing passwords

sitemap