### More thoughts on TCRs

#### by Paul Crowley

A few more notes regarding target collision resistant functions, following up from my $1000 competition announcement.

# Second preimage resistance

There is a simple way to construct a secure TCR compression function given a second-preimage-resistant compression function—just generate a key which is the length of the input, and XOR the key with the input. So if we can build a fast second-preimage-resistant function, we can build a fast secure TCR.

The history of hash functions shows that we have been much more successful at achieving second-preimage resistance than collision resistance. From the excellent Lessons From The History Of Attacks On Secure Hash Functions:

The main result is that there is a big gap between the history of collision attacks and pre-image attacks. Almost all older secure hash functions have fallen to collision attacks. Almost none have ever fallen to pre-image attacks.

Secondarily, no new secure hash functions (designed after approximately the year 2000) have so far succumbed to collision attacks, either.

# Tweakable target collision resistance

In the definition of target collision resistance, the attacker supplies a single message, but in practice, we usually want to hash many messages with the same key, eg when constructing a variable-length TCR from a compression function that takes a fixed-length message. This is OK because there’s a straightforward security reduction which shows that if an attacker can find a collision for a single message with probability *ε*, then they can forge a collision for any of n messages with probability at most *nε*.

However, when the messages to be signed are large as they are in Android, this linear falloff is kind of a shame. One possible advantage of TCRs is that it can be secure to use much shorter hash outputs, say 128 bits, which will make Merkle trees much smaller, saving disk space and improving performance. But if the hash function consumes, say, 128 bytes at a time (like BLAKE2) and the system partition is 1GB, it will be broken up into 2^{23} messages, leaving us with only 105-bit security at best. I’d like to do a little better than that, and so I’d like to build multiple-message security into the security definition. I propose a new kind of primitive, a *tweakable TCR*, which takes a tweak as well as a key and a message. The attacker faces the following challenge:

- Attacker chooses
*n*messages*m*_{1}…*m*_{n}and*n*distinct tweaks*t*_{1}…*t*_{n} - Attacker learns random key
*K* - Attacker chooses
*i*,*m*’ - Attacker wins if
*m*’ ≠*m*_{i}but*H*(*K*,*t*_{i},*m*’) =*H*(*K*,*t*_{i},*m*_{i})

If each of the 2^{23} messages gets a distinct tweak, we can preserve 128-bit security across large partitions. I therefore encourage people to design not just TCRs, but TTCRs!

[…] I’ve moved some technical notes into a subsequent blog post. […]