bintohex() and random_bytes() functions are undefi

2020-05-09 01:42发布

I'm trying to call

echo bintohex(random_bytes(30));

But my logs show

PHP Fatal error:  Call to undefined function bintohex()

PHP 5.6.17
Apache 2.2.15
CentOS 6.7
Mcrypt 2.5.8 (installed and verified on phpinfo() page)
extension=mcrypt.so (present)

Any ideas why I can't find bintohex() or random_bytes() functions?

1条回答
【Aperson】
2楼-- · 2020-05-09 02:05

Because it bin2hex http://php.net/manual/en/function.bin2hex.php not "bintohex"

random_bytes basically exist only in Php 7 according to docs http://php.net/random_bytes but here is polyfill to 5.x version https://github.com/paragonie/random_compat

查看更多
登录 后发表回答