Home > PHP > Function > Mcrypt > mcrypt_create_iv()

mcrypt_create_iv()

mcrypt_create_iv - Create an initialization vector (IV) from a random source

Syntax

string mcrypt_create_iv (int $size, int $source)

Arguments

  • size - Determines the size of the IV, parameter source (defaults to random value) specifies the source of the IV.
  • source - The source can be MCRYPT_RAND (system random number generator), MCRYPT_DEV_RANDOM (read data from /dev/random) and MCRYPT_DEV_URANDOM (read data from /dev/urandom). Prior to 5.3.0, MCRYPT_RAND was the only one supported on Windows.

Description

Create an initialization vector (IV) from a random source.

Version

PHP 4, 5

Return value

Returns the initialization vector, or FALSE on error.