<?php
$iv_size = mcrypt_enc_get_iv_size ($td));
$iv = @mcrypt_create_iv ($iv_size, MCRYPT_RAND);
if (@mcrypt_generic_init ($td, $key, $iv) != -1)
{
$c_t = mcrypt_generic ($td, $plain_text);
@mcrypt_generic_init ($td, $key, $iv);
$p_t = mdecrypt_generic ($td, $c_t);
}
if (strncmp ($p_t, $plain_text, strlen($plain_text)) == 0)
echo "ok";
else
echo "error";
?> |