News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Scott MacVicar's Blog:
Accessing pseudo random data with PHP
December 15, 2008 @ 10:24:17

To help alleviate some recent complaints about the pseudo-random nature of the random functions in PHP, Scott MacVicar has proposed an alternate solution:

With all these potential different ways to get some pseudo random data it would be hard to do this in native PHP. Now we could do this in C and implement all the code ourselves but why risk implementing our own random functions and potentially making a mistake? The answer is OpenSSL, we already have an OpenSSL module and obviously they have some random functionality built in for when you go to generate SSL certificates.

You can make a call to the openssl_random_pseudo_bytes (in PHP 5.3) to grab the number of bytes you need and pass in a "strong" value to get a more cryptographically secure value.

6 comments voice your opinion now!
random string data openssl pseudo bytes php5


blog comments powered by Disqus

Similar Posts

Kevin Schroeder's Blog: ZF2 Dependency Injection: Managing Configuration - Part 2

HowTo Forge: How To Harden PHP5 With Suhosin (Debian Etch/Ubuntu)

Builder.com.au: PHP 4 on death row

Simon Champion: PHP Upgrade Broke My Data Importer

IBM developerWorks: What's new in PHP V5.2, Part 5: Tracking file upload progress


Community Events





Don't see your event here?
Let us know!


community version application release composer podcast package language introduction interview security voicesoftheelephpant opinion laravel tool symfony install library framework series

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework