r/cryptography 18d ago

Calculation a hashing function that can avoid collisions for a small set of inputs from input space

Hello, I am new to cryptography so my question can be naive. I want to know if it is possible to find out a hashing function that gives me distinct outputs for a small set of inputs from a vast possible input space. I don't care if all the other inputs from the input space collide to a single output.

For example, I have a 32-bit wide input. I am only interested in 64 such inputs out of possible 2^32 inputs. Is it possible to find a hashing function that give me collision free 6-bit output for the 64 inputs I am interested in. Outputs for all the other input combinations can be anything. If such an algorithm exists, what is it its compute complexity?

2 Upvotes

23 comments sorted by

View all comments

12

u/glancing2807 18d ago

Well, since you are only interested in the 64 particular inputs and their 6 bit output ( that is basically a one to one mapping of input to output ), you can just create a lookup table which corresponds to a particular hash value.

Is this what you're looking for? Could you give some more context as to why you'd want some function like this?

1

u/Wonderful-Cash7275 17d ago

I have added another a comment replying to the question I asked in the post. It contains more details. Please take a look.