29
$\begingroup$

Hashing is useful for checking that an input matches expectations without giving away the stored expected version - so confirming passwords etc.

But are there other use cases? In general, cryptographic storage so data is retrievable seems to be the norm.

$\endgroup$
7
  • 10
    $\begingroup$ Message signing. $\endgroup$ Commented Dec 5, 2018 at 11:23
  • 7
    $\begingroup$ ...ratcheting, commitment schemes, proofs of work, Lamport signatures... $\endgroup$ Commented Dec 5, 2018 at 11:42
  • 3
    $\begingroup$ You could use it in counter mode to build a stream cipher. This is in some ways just an echo of someone else's answer about using it to create a CSPRNG, since the stream cipher answer uses this non-reversible crypto in that very way. $\endgroup$
    – WDS
    Commented Dec 5, 2018 at 13:01
  • $\begingroup$ @WDS enc(Mi,k) = Mi ^ hash(i && k) ? $\endgroup$
    – curiousguy
    Commented Dec 5, 2018 at 14:18
  • 2
    $\begingroup$ For those answering on comments, can I ask a favour: please leave them as answer posts. Comments will go and are not for this purpose. $\endgroup$
    – Rory Alsop
    Commented Dec 6, 2018 at 18:17

5 Answers 5

68
$\begingroup$
  • Data integrity is another usage. For example, when you want to send/download data, you want to make sure that the data is not modified or transmitted/downloaded correctly. To achieve this the data hashed and the hash value sent/downloaded on another channel. One may see examples of this file verification on Linux ISO download pages. Of course, hashing is not enough to protect you against some attacks. Therefore you need digital signatures.

  • Another one, when digitally signing the document, we first hash the document then sign the hash value. This is more efficient than signing the whole document.

  • Keyed-Hash Message Authentication Code (HMAC) is a message authentication code (MAC) that involves a Cryptographic hash function and a Cryptographic key.

  • Key Derivation Functions are also using hash functions to derive a key from your password plus various random sources.

  • Key Stretching: making a possibly weak password more robust against brute-force attacks. PNKDF2, bcrypt, Argon2 use key stretching.

  • Ratcheting: forward key chaining with no backward availability.

  • A special case of hash usage is the Merkle-Tree to verify the integrity of data with low bandwidth.

  • In Blockchains: hashes are a fundamental part of the blockchains.

  • Proof-of-work systems:

    A Proof-of-Work (PoW) system (or protocol, or function) is an economic measure to deter denial of service attacks and other service abuses such as spam on a network by requiring some work from the service requester, usually meaning processing time by a computer.

    Bitcoin mining and Hashcash use Proof-of-work systems.

  • Constructing Stream Ciphers as in ChaCha2 in TLS 1.3. This construction uses CTR mode of operation.

  • Public Key Cryptography: Trapdoor one-way functions are easy to compute hard to invert without special information. Most of the public key cryptosystems are based on Trapdoor one-way functions.

  • Commitment schemes allow committing a value while keeping others hidden and give the ability to reveal at a later time.

  • Lamport signature or Lamport one-time signature scheme can use one-way functions in which usually cryptographic hash functions are preferred.

  • Secure Random Number Generators such as Hash_DRBG use hash functions to improve and stretch the output from a true random number generator

$\endgroup$
5
  • 1
    $\begingroup$ Data integrity doesn't require non-reversible crypto. For example, CRCs are widely used for error detection but are easily reversible. $\endgroup$
    – nwellnhof
    Commented Dec 5, 2018 at 17:44
  • 9
    $\begingroup$ @nwellnhof CRC and checksums are used to detect transmission errors, but aren't generally considered strong enough to detect intentional modification, which can easily be done in a way that preserves the integrity code. $\endgroup$
    – Barmar
    Commented Dec 5, 2018 at 18:03
  • 1
    $\begingroup$ All of these, expect perhaps a few "Secure Random Number Generators, Ratcheting, Proof-of-work systems" seems like variations on a "password". Still a nice list. $\endgroup$ Commented Dec 7, 2018 at 6:36
  • 2
    $\begingroup$ @chux I'm not sure who uses a "complete copy of avengers: infinity war" as a "password": that is the kind of thing you verify with "data integrity". The OP's "password" focused on not giving away the actual password; here, it is "not having to transmit the actual file twice", which is a very different thing. $\endgroup$ Commented Dec 7, 2018 at 19:05
  • 2
    $\begingroup$ We should also add Hashed-Timelock Contracts (HTLC) for cross chain atomic swaps (although it could be considered a commitment scheme). Additionally, Zero knowledge proofs from hash functions (i.e., zkStark and Ligero) and also note that Lamport’s scheme has multi-time variations such as XMSS, BPQS and Sphincs. $\endgroup$ Commented Dec 7, 2018 at 23:46
28
$\begingroup$

Applications for one-way-functions in cryptography

Hash-collisions may happen in rare cases, but are mostly disregarded here.

Data integrity

Integrity

A quick way to ensure integrity of data is to compare two hashes, where one is a previously calculated hash and the other is the newly calculated hash of the data, which is presumed to be unmodified. If the previous hash matches with the new one, then the data has in fact not been changed.

Comparing two hashes is computationally very efficient compared to "bit-by-bit" comparison of large data.

Authenticity

Downloadable files often have a checksum (usually SHA256) for that same file published as well. This way you can also compute the checksum after downloading the file. If the checksums match then you know that the file hasn't been modified, i.e. adding backdoors, viruses, worms, etc.

Passwords

I won't go into detail here, because you mainly asked for other applications than password-hashing. The main advantage of one-way-functions concerning passwords is obviously, that you don't have to store the passwords as plaintext and still can authenticate users.

Digital signatures

The function of digital signatures is basically the same as signatures on paper with ink. They ensure the authenticity of the source not of the file. They are very commonly used in Emails, this way the receiver of a message can verify that the sender is in fact the person who wrote the Email.

Proof-of-work

A popular example of proof-of-work is the mining of bitcoins, where miners have to calculate a certain hash-value. This way it's relatively easy to verify a certain value (in the example of bitcoin-mining you "verify" the integrity of the decentralized nodes in the P2P bitcoin network) but very hard to do the same work for a possible attacker.

Cryptographically secure pseudorandom number generators

CSPRNG's have a relatively wide use in cryptography, i.e:

  • key generation
  • salts

CSPRNGs in contrast to "normal" PSNGs must have the requirement of being one-way-functions (which again is not yet proven if such generators exist).

Key derivation function

A KDF is used to retrive several (at least one) secret keys from a master-secret-key. Keyed cryptographic hash functions are popular examples of pseudorandom functions used for key derivation.

$\endgroup$
2
  • 6
    $\begingroup$ Tiny little niggle: CSPRNGs can't make OTPs. $\endgroup$
    – Paul Uszak
    Commented Dec 5, 2018 at 21:40
  • 3
    $\begingroup$ @PaulUszak is absolutely correct. When you use a CSPRNG for an OTP, you just have a stream cipher. $\endgroup$
    – forest
    Commented Dec 7, 2018 at 4:16
6
$\begingroup$

There is a body of theorems that shows that a one-way function is sufficient to build many, many types of symmetric cryptography schemes. As the link puts it:

The existence of a one-way function implies the existence of many other useful concepts, including:

  • Pseudorandom generators
  • Pseudorandom function families
  • Bit commitment schemes
  • Private-key encryption schemes secure against adaptive chosen-ciphertext attack
  • Message authentication codes
  • Digital signature schemes (secure against adaptive chosen-message attack)

The existence of one-way functions also implies that there is no natural proof for $\mathrm{P} ≠ \mathrm{NP}$.

So yeah, useful.

$\endgroup$
4
$\begingroup$

Hash functions are ubiquitous in cryptography. No matter to even try to list all applications...

Just one example: signature schemes which are constructed only out of a hash -function (https://en.wikipedia.org/wiki/Hash-based_cryptography)

$\endgroup$
2
$\begingroup$

Hashing also has many non crypto uses. They are still used as a method for avoiding unbalanced indexes and tables, or queue allocation, and scheduling, as well as check digit calculations and fingerprinting (mda5 is still commonly used for download verification).

The intent is even distribution, hence the term "Hash" as we are stirring up the mix to even things out, to avoid hot spots and balance resources.

$\endgroup$
2
  • 1
    $\begingroup$ One-wayness is not necessary for this type of "hash", so I don't think this answers the posed question. $\endgroup$
    – Maeher
    Commented Dec 7, 2018 at 13:20
  • $\begingroup$ The OP explicitly asks for "other" use cases, where this is *not" the requirement. $\endgroup$
    – mckenzm
    Commented Dec 8, 2018 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.