A
A
Alexey Nikolaev2015-10-02 16:37:51
PHP
Alexey Nikolaev, 2015-10-02 16:37:51

How unique is the session ID?

Good afternoon.
There is such a question - where is the limit of the uniqueness of the session id? Knowing that in practice it is almost impossible to guess it, where can be the limit beyond which the generated sessions will begin to repeat?
Let's say the table has a session_id field that stores the actual user session ID. Each new guest is one new entry. Can this lead to duplicate records appearing in the table sooner or later?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Kovalsky, 2015-10-02
@dmitryKovalskiy

In theory, yes, of course. If 2 ^ 128 degrees of people (devices) come to you in one second, then the likelihood of dubbing will appear ... however, it is worth recognizing that at this moment you will have other problems. For example, where to get the resources to process such traffic

D
Daemon23RUS, 2015-10-02
@Daemon23RUS

In practice, yes, it will definitely happen. The question is after how much ... after all, there is an insignificant fraction of the probability that after 1 -2 minutes.
And following the logic, if such an event is possible, then it cannot be used as a key field.
I would add a timestamp to the session_id. This will be a truly unique value.

D
Dimonchik, 2015-10-02
@dimonchik2013

you want horror?
habrahabr.ru/post/137316
therefore, they usually generate with a random salt, for example,
well, all sorts of UUIDs have long been provided for

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question