You are here

function aes_make_iv in AES encryption 5

Same name and namespace in other branches
  1. 6 aes.module \aes_make_iv()
  2. 7 aes.module \aes_make_iv()
3 calls to aes_make_iv()
aes_config_submit in ./aes.module
aes_enable in ./aes.module
aes_encrypt in ./aes.module
Encrypts a string.

File

./aes.module, line 434

Code

function aes_make_iv() {
  if (strtoupper(substr(PHP_OS, 0, 3)) === "WIN") {
    $randgen = MCRYPT_RAND;
  }
  else {
    $randgen = MCRYPT_DEV_URANDOM;
  }
  $td = mcrypt_module_open(variable_get("aes_cipher", "rijndael-128"), "", MCRYPT_MODE_CBC, "");
  $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), $randgen);
  mcrypt_module_close($td);
  variable_set("aes_encryption_iv", base64_encode($iv));
}