Browse Source

Use random_bytes when available (#487)

Pavel Djundik 4 năm trước cách đây
mục cha
commit
fa0ac8cd23
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      backend/garbage.php

+ 5 - 1
backend/garbage.php

@@ -53,7 +53,11 @@ function sendHeaders()
 $chunks = getChunkCount();
 
 // Generate data
-$data = openssl_random_pseudo_bytes(1048576);
+if (function_exists('random_bytes')) {
+    $data = random_bytes(1048576);
+} else {
+    $data = openssl_random_pseudo_bytes(1048576);
+}
 
 // Deliver chunks of 1048576 bytes
 sendHeaders();