# Reverse a key diversification algorithm

What are the possible ways of reversing a key diversification algorithm? This is used to generate a different key for each user.

I know the operands involved (three 4 bytes values) and the result (the key, also 4 bytes long), but I don't know the function that given the operands generates the key.

I have read something about MIFARE key diversification but my case is different and it should be easier:

I know there is no master/secret key involved and that the final key is based only on these 3 values I have so I just miss the arithmetic/logical operations between these values.

Any suggeston?

• For that kind of question, you NEED to specify what you're having to work with. Here, you don't specify if you have the binary available, the kind of performance involved, the size of your sample dataset. Also, you need to understand that the function will HAVE to be a reduction: the best you can do is get one valid set of input that gives you a given output but you can't guarantee that it was the same one as initially used. Commented Nov 22, 2017 at 10:58
• @Stephane i wrote everything i know: the 3 input values and the output key. I can get more inputs and more corresponding output keys to verify if the function is correct. There is a piece of hardware which i cannot touch that does the computation so I'm blind. Please note that i'm not asking for a solution (that's why I didn't write the values and the key) but for a "way of thinking" in this situations Commented Nov 22, 2017 at 11:31
• the devil is in the details: we have no idea what you're working with so the only answer given what you've revealed is Steffen's "it's impossible". That is because there is an infinity of mapping function between the two key spaces and you have not provided ANY distinguishing factor. So, if you want ideas of how to progress, you really NEED to give sufficient information about what you have that simplify that impossible problem into a possible one. Commented Nov 22, 2017 at 12:19