# OTP sequence uniqueness

Is it possible to use Time-based One Time Password (TOTP) algorithms to generate tokens from multiple channels (where a channel is defined as a "user" using a certain shared key $K_c$ for channel $c$), and in so doing identify the channel itself from the OTP?

My overall objectives are to:

1. Generate hash outputs that will never "collide" provide the inputs to such hash function never collide.
2. Identify from the hash output (the OTP) what the "channel" was that created it, and whether it is a valid OTP. This is trivial for a single channel generating OTP's, but you need an "authenticator" for every channel. I want one server side authenticator for multiple channels/users and be able to derive from the OTP itself what the channel/user is.

### My current approach:

Suppose two OTP's were generated with the same time sequence constant $i_0$, and shared secret keys $K_1$ and $K_2$ respectively. Let $A$ and $B$ be the OTP's: \begin{align*} A &= \text{HMAC-SHA-1}(K_1, i_0) \\ B &= \text{HMAC-SHA-1}(K_2, i_0) \\ \end{align*} Would it be possible on the server side during validation to establish without the shadow of a doubt (mathematically speaking) that $A$ is "linked" to channel 1 ($K_1$), and $B$ to channel 2? In other words, every OTP generated using $K_1$ will be different to those OTP's generated using $K_2$ regardless of the truncation of the 160-bit output of HMAC. I believe this is the equivalent of enquiring as to uniqueness of the output of a hash function given unique inputs.

If this happens, and the two "sequences" are different, can their difference be quantified in terms of say a Hamming distance?

-
@Basie: Welcome to Crypto.SE! Make sure to register your account over here to take back ownership of your question :) –  figlesquidge Feb 17 at 18:32

## migrated from cs.stackexchange.comFeb 17 at 18:19

This question came from our site for students, researchers and practitioners of computer science.

Yes, it is possible. You described how in your question. I'm not sure what your remaining problem is. You can think of this as two totally different, independent logical "users" -- or as two different OTP sequences -- with both of them assigned to the same person, using a different one for each channel. If the OTP scheme is secure, then your approach will be secure too.

The difficult part will be the usability aspects: to convince the user to make to use the proper OTP sequence for the channel they are using.

Also, OTPs are not secure against man-in-the-middle attacks, so they are not a complete solution.

Lastly, one tip for how to get better answers here. Try describing what you are trying to achieve (what your requirements are) and ask for how to achieve it. You might get answers or approaches that you hadn't anticipated.

-
Thanks for the answer D.W. To summarise what I am trying to do: (1) Generate hash outputs that will never "collide" provide the inputs to such hash function never collide. (2) Identify from the hash output (OTP) what the "channel" was that created it, and whether it is a valid OTP. This is trivial for a single channel generating OTP's, but you need an "authenticator" for every channel. I want one server side authenticator for multiple channels/users and be able to derive from the OTP itself what the channel/user is. –  Basie Kok Feb 17 at 7:12
In the meantime I am going to accept your answer and implement this. I will find out soon enough if there are collisions. Thanks! –  Basie Kok Feb 17 at 7:16