-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
191b04a
commit cfa429f
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
namespace Sodium; | ||
|
||
/** | ||
* This does nothing if the libsodium extension is loaded, so it's harmless. | ||
* | ||
* This file alone is released under CC0 and WTFPL dual licensing. | ||
*/ | ||
if (!extension_loaded('libsodium')) { | ||
|
||
/** | ||
* Generate a string of random bytes | ||
* /dev/urandom | ||
* | ||
* @param int $length | ||
* @return string | ||
*/ | ||
function randombytes_buf( | ||
$length | ||
) { | ||
return ''; | ||
} | ||
|
||
/** | ||
* Generate a 16-bit integer | ||
* /dev/urandom | ||
* | ||
* @return int | ||
*/ | ||
function randombytes_random16() { | ||
return ''; | ||
} | ||
|
||
/** | ||
* Generate an unbiased random integer between 0 and a specified value | ||
* /dev/urandom | ||
* | ||
* @param int $upperBoundNonInclusive | ||
* @return int | ||
*/ | ||
function randombytes_uniform( | ||
$upperBoundNonInclusive | ||
) { | ||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters