# Can you explain the counter in the Key derivation function of PACE?

I try to understand the PACE-Protocol, especially the Key Derivation Function in ECDH on page 33.

Can someone explain me, what the Counter is good for? Often there are iteration counters in KDF - but here are usual Hash-Functions (like SHA-256) are used as KDF. So there is no iteration. Is this something like a message counter so that we create a new Hash for every new message?

-

## migrated from stackoverflow.comJan 29 '14 at 19:07

This question came from our site for professional and enthusiast programmers.

Welcome to crypto, Thomas. Sorry for the detour :) – Maarten Bodewes Jan 30 '14 at 21:40

The counter is used to distinguish the different (session) keys used in the protocols. A relatively standard KDF is used, KDF2. Note that only a single iteration is needed and that no OtherInfo has been defined, so the specification of KDF2 may look more complex than it is in the PACE protocol. A 32 bit counter is of course overkill for the protocol, but that's just how the counter has been defined.
So you have the counter valued 1, encoded as 00000001 in hexadecimals as input for the encryption key, and a counter valued 2, encoded as 00000002 for the MAC key.