paragonie/sodium_compat

Fatal error: Call to undefined function random_bytes()

dev-iwf opened this issue · 3 comments

Hello,

The following error is occurring when I try to run any of the Using Sodium Compat examples in the README.

Fatal error: Call to undefined function random_bytes() in /path/to/sodium_compat-1.6.1/src/Core/Ed25519.php on line 24

As I understand it, random_bytes() is only available in PHP >= 7.
Is there a reason for this error or am I missing something?

I managed to circumvent the error by using Random-Compat (https://github.com/paragonie/random_compat), but ideally I'd want to avoid this.

Random_compact is required for this library, as pointed in composer.json. Running composer install should install random_compat for you.

Thank you. I've missed that since I looked at the Install From Source

Yeah, I guess that section is somewhat misleading. Either it should mention that you need to have/install random_compact separately, or the tarball should already include that library, just like PHAR release.