<?php $td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, ''); var_dump(mcrypt_enc_is_block_mode($td)); $td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_ECB, ''); var_dump(mcrypt_enc_is_block_mode($td)); $td = mcrypt_module_open(MCRYPT_ARCFOUR, '', MCRYPT_MODE_STREAM, ''); var_dump(mcrypt_enc_is_block_mode($td)); $td = mcrypt_module_open(MCRYPT_WAKE, '', MCRYPT_MODE_STREAM, ''); var_dump(mcrypt_enc_is_block_mode($td));
$CC = "4007000000027"; $encrypted = mcrypt_ofb(MCRYPT_RIJNDAEL_128, substr($key, 0, 32), $CC, MCRYPT_ENCRYPT, substr($key, 32, 16)); $decrypted = mcrypt_ofb(MCRYPT_RIJNDAEL_128, substr($key, 0, 32), $encrypted, MCRYPT_DECRYPT, substr($key, 32, 16)); VERIFY($encrypted !== $decrypted); VS($decrypted, $CC); ////////////////////////////////////////////////////////////////////// VS(mcrypt_get_block_size("tripledes", "ecb"), 8); VS(mcrypt_get_cipher_name(MCRYPT_TRIPLEDES), "3DES"); VS(mcrypt_get_iv_size(MCRYPT_CAST_256, MCRYPT_MODE_CFB), 16); VS(mcrypt_get_iv_size("des", "ecb"), 8); VS(mcrypt_get_key_size("tripledes", "ecb"), 24); $td = mcrypt_module_open("cast-256", "", "cfb", ""); VS(mcrypt_enc_get_algorithms_name($td), "CAST-256"); $td = mcrypt_module_open("tripledes", "", "ecb", ""); VS(mcrypt_enc_get_block_size($td), 8); $td = mcrypt_module_open("cast-256", "", "cfb", ""); VS(mcrypt_enc_get_iv_size($td), 16); $td = mcrypt_module_open("tripledes", "", "ecb", ""); VS(mcrypt_enc_get_key_size($td), 24); $td = mcrypt_module_open("cast-256", "", "cfb", ""); VS(mcrypt_enc_get_modes_name($td), "CFB"); $td = mcrypt_module_open("rijndael-256", "", "ecb", ""); VS(mcrypt_enc_get_supported_key_sizes($td), array(16, 24, 32)); $td = mcrypt_module_open("tripledes", "", "ecb", ""); VS(mcrypt_enc_is_block_algorithm_mode($td), true); $td = mcrypt_module_open("tripledes", "", "ecb", ""); VS(mcrypt_enc_is_block_algorithm($td), true); $td = mcrypt_module_open("tripledes", "", "ecb", ""); VS(mcrypt_enc_is_block_mode($td), true); $td = mcrypt_module_open("tripledes", "", "ecb", ""); VS(mcrypt_enc_self_test($td), 0);