function WADecrypt($src, $key){ $pkey = $key; while (strlen($pkey)<16) $pkey .= '0'; $data = explode('|',$src); $iv = $data[0]; $enc = base64_decode($data[1]); $dec = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $pkey, $enc, MCRYPT_MODE_CBC, $iv); $block = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, 'cbc'); $pad = ord($dec[($len = strlen($dec)) - 1]); return substr($dec, 0, strlen($dec) - $pad); }