0
I am setting up a login system for my projects. So far I have understood that they are usually used Sesssions, preferably.
The article says that a good practice is to use session ids with at least 128 bits of size and 64 bits of entropy, to make id guessing difficult.
Does anyone have any hint to generate an id with these features?
It seems to me is only gives a Randon from 0 to 340.282.366.920.938.463.463.374.607.431.768.211.456(or something nearby)
I think it’s easier to work with an alphanumeric string, right? (with unns 26 digits)
Recalling that the entropy and predictability of a random number generated with
random_bytes()
depends on of the algorithmCSPRNG
implemented in the machine operating system. And if there is no one available, an exception will be launched.– Lacobus
If the operating system is unsafe... nothing implemented in it will be. It is much better to use the
/dev/urandom
(or equivalent) than using Mersenne Twister.– Inkeliz
In theory, right?! A lot has been implemented based on
OpenSSL
and we come across the Heartbleed Bug and the mischief of NSA and its cryptographic backdoors, that have affected even the kernel linux.– Lacobus
No need to go that far, Openssl actually has several problems, including in PHP. If the NSA puts a backdoor, both a Kernel and a Userland will be compromised. Openssl makes a
MD5
(I don’t know if it is until today) of/dev/random
. If the/dev/random
is maliciously weak, everything will go bad. So, even the ownrandom_bytes()
would be. But, this is the fault of the OS, not the function, which is not the case of atime()
ormt_rand()
, he is weak for being weak. If you don’t trust the OS, you can’t believe in anything else.– Inkeliz
I’d rather trust a kernel full of bugs and backdoors than in the dice and in the haha coins.
– Lacobus