Hi, I'm going to start encrypting credit cards with the mcrypt functions. I encrypted the credit cards like so: $key = 'test'; $cc = "1234567890123456"; $td = mcrypt_module_open ('tripledes', '', 'ecb', ''); $key = substr ($key, 0, mcrypt_enc_get_key_size ($td)); $iv_size = mcrypt_enc_get_iv_size ($td); $iv = mcrypt_create_iv ($iv_size, MCRYPT_RAND);
// Initialize encryption handle if (mcrypt_generic_init ($td, $key, $iv) != -1) { // Encrypt data $ciphertext = mcrypt_generic ($td, $cc); mcrypt_generic_deinit ($td); // Reinitialize buffers for decryption mcrypt_generic_init ($td, $key, $iv); $plaintext = mdecrypt_generic ($td, $ciphertext); // Clean up mcrypt_generic_deinit ($td); mcrypt_module_close ($td); print "<font face=Arial size=2><b>Ciphertext:</b> $ciphertext<Br>"; print "<b>Plaintext:</b> $plaintext</font>"; } Sometimes, when I decrypt a cc it contains binary data...it's not fully decrypted. There's some plaintext in it and there's also binary. Does anyone know why this happens or how I can fix it? Thanks, Tyler -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php