CI_Security::get_random_bytes()

get_random_bytes($length)

Parameters:
  • $length (int) – Output length
Returns:

A binary stream of random bytes or FALSE on failure

Return type:

string

A convenience method for getting proper random bytes via mcrypt_create_iv(), /dev/urandom or openssl_random_pseudo_bytes() (in that order), if one of them is available.

Used for generating CSRF and XSS tokens.

Note

The output is NOT guaranteed to be cryptographically secure, just the best attempt at that.

doc_CodeIgniter
2016-10-15 16:31:51
Comments
Leave a Comment

Please login to continue.