Unique? Impossible, sorry .
Let's take a closer look:
With 18 characters, even if we only accepted 128 possible ASCII characters (7 bits), you would get 128 ^ 18 possible lines (and I'm not even going to use shorter lines!), Which is about 8E37 (8 and 37 zeros) .
With a 4-byte integer, you get 256 ^ 4 possible integers, which is about 4E9 (4 billion).
So, you have 4E28 more lines than you have integers; You cannot have a unique mapping.
Therefore, you will certainly encounter a collision as soon as you enter the key 4294967297th, but you can run it as soon as you enter more than one.
See also: http://en.wikipedia.org/wiki/Pigeonhole_principle
source share