mirror of
https://github.com/nextcloud/server.git
synced 2024-07-25 13:54:59 +02:00
Use /dev/urandom instead of /dev/random
The usage of /dev/urandom is enough secure
This commit is contained in:
parent
24ad6b5a62
commit
fa71e51e67
@ -594,8 +594,8 @@ class OC_Util {
|
||||
}
|
||||
}
|
||||
|
||||
// Try to use /dev/random
|
||||
$fp = @file_get_contents('/dev/random', false, null, 0, $length);
|
||||
// Try to use /dev/urandom
|
||||
$fp = @file_get_contents('/dev/urandom', false, null, 0, $length);
|
||||
if ($fp !== FALSE) {
|
||||
$string = substr(bin2hex($fp), 0, $length);
|
||||
return $string;
|
||||
@ -628,8 +628,8 @@ class OC_Util {
|
||||
}
|
||||
}
|
||||
|
||||
// Check /dev/random
|
||||
$fp = @file_get_contents('/dev/random', false, null, 0, 1);
|
||||
// Check /dev/urandom
|
||||
$fp = @file_get_contents('/dev/urandom', false, null, 0, 1);
|
||||
if ($fp !== FALSE) {
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user