Create New Item
×
Item Type
File
Folder
Item Name
×
Search file in folder and subfolders...
File Manager
/
wp-includes
/
random_compat
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php if (!is_callable('random_bytes')) { function random_bytes($bytes) { try { $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError('random_bytes(): $bytes must be an integer'); } if ($bytes < 1) { throw new Error('Length must be greater than 0'); } $buf = ''; if ($bytes > 2147483647) { for ($i = 0; $i < $bytes; $i += 1073741824) { $n = $bytes - $i > 1073741824 ? 1073741824 : $bytes - $i; $buf .= Sodium::randombytes_buf((int) $n); } } else { $buf .= Sodium::randombytes_buf((int) $bytes); } if (is_string($buf)) { if (RandomCompat_strlen($buf) === $bytes) { return $buf; } } throw new Exception('Could not gather sufficient random data'); } }