Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

ID with the below structure

XXXXXXX-1234-5678-9012-345-C

where

XXX XXXX - series, can be used to split ID's between the groups based on the way how it was generated. Or we can just use it to increase number of combinations and decrease the collision probability

initially we can should generate all the ids within the same series.

Options for the series:

  1.  all all the latin letters - 8000 810,000 combinations
  2. numbers and only some letters that looks the same in Cyrillic and Latin alphabet and can be entered via the phone keypad: A, E, H, K, M, P, T, X - 512 combinations104,976 combinations
  3. numbers - 1000 10,000 combinations

It is proposed to go with option 2 with the possibility to extend to option 1 if needed in future


1234-5678-9012-345 - randomly generated numbers

Number of combinations - 1100,000,000,000,000

Options for numbers:

...

Total number of possible combinations excluding series will be:

51251,200,000,000,000,000

Probability of collisions: 0.1% 01% probability in the range of around 5.5 millions.



Probability of collisions including series: 0.0001% probability in the range of around 3 24 millions.


Solution

...

2 - TO GO!

The same as solution1, but 

XXXX-12E4-5A8-P01X-T3 -52A8-P01-3

XXXX-12E4-52A8-P01 randomly generated numbers and letters A, E, H, K, M, P, T, X.

...

In this case we might not check if ID is unique. 

But this This number is shorter but not so convenient for human to work with.


Code Block
languagepy
titlecollision probability
collapsetrue
from math import log1p, sqrt

def birthday(probability_exponent, bits):
    probability = 10. ** probability_exponent
    outputs     =  2. ** bits
    return sqrt(2. * outputs * -log1p(-probability))

print birthday(-6, 68)