Skip to content
Snippets Groups Projects
Commit fa71e51e authored by Lukas Reschke's avatar Lukas Reschke
Browse files

Use /dev/urandom instead of /dev/random

The usage of /dev/urandom is enough secure
parent 24ad6b5a
No related branches found
No related tags found
No related merge requests found
...@@ -594,8 +594,8 @@ class OC_Util { ...@@ -594,8 +594,8 @@ class OC_Util {
} }
} }
// Try to use /dev/random // Try to use /dev/urandom
$fp = @file_get_contents('/dev/random', false, null, 0, $length); $fp = @file_get_contents('/dev/urandom', false, null, 0, $length);
if ($fp !== FALSE) { if ($fp !== FALSE) {
$string = substr(bin2hex($fp), 0, $length); $string = substr(bin2hex($fp), 0, $length);
return $string; return $string;
...@@ -628,8 +628,8 @@ class OC_Util { ...@@ -628,8 +628,8 @@ class OC_Util {
} }
} }
// Check /dev/random // Check /dev/urandom
$fp = @file_get_contents('/dev/random', false, null, 0, 1); $fp = @file_get_contents('/dev/urandom', false, null, 0, 1);
if ($fp !== FALSE) { if ($fp !== FALSE) {
return true; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment