Codrin Strîmbei
Codrin Strîmbei

Reputation: 125

Hashing integers to alphanumeric with no collision

Do you know any hashing method for a long numeric string to a shorter alphanumeric? I need to obtain a unique string of max length 10 out of 3 strings with a total of 33 digits.

Upvotes: 0

Views: 149

Answers (1)

MBo
MBo

Reputation: 80197

You cannot map all possible length 33 decimal sequences 1:1 into length 10 alphanumeric string with reasonable alphabet size (you need alphabet size 2000: 10^33 = x^10 => x~1996)

But for limited known set of decimal sequences - you can calculate perfect hash and represent hash values in appropriate system (for example: in 36 radix using 0..9, A..Z chars)

Upvotes: 3

Related Questions