fr@nkie Posted January 10, 2007 Share Posted January 10, 2007 Hi. I'm new in php encriptation and I want to know what's wrong with my code.How can I decrypt some data that I encrypt in another file?<?php $key = "MyKey"; $data = "Secret message"; //encrypt $td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, ' ', MCRYPT_MODE_CFB, ' '); $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), 222); mcrypt_generic_init($td, $key, $iv); $encrypt_data = mcrypt_generic($td, $data); mcrypt_generic_deinit($td); mcrypt_module_close($td); //decrypt $td1 = mcrypt_module_open(MCRYPT_RIJNDAEL_256, ' ', MCRYPT_MODE_CFB, ' '); $iv1 = mcrypt_create_iv (mcrypt_enc_get_iv_size($td1), 222); $key = substr($key, 0, mcrypt_enc_get_key_size($td1)); mcrypt_generic_init($td1, $key, $iv1); $decrypt_data = mdecrypt_generic($td1, $encrypt_data); mcrypt_generic_deinit($td1); mcrypt_module_close($td1); //print echo "<p>Data encrypt: " . $encrypt_data . ".</p>\n"; echo "<p>Data decrypt: " . $$decrypt_data . ".</p>\n";?> Link to comment https://forums.phpfreaks.com/topic/33635-php-encriptation-question/ Share on other sites More sharing options...
emehrkay Posted January 10, 2007 Share Posted January 10, 2007 i guess we're supposed to decrypt the question... Link to comment https://forums.phpfreaks.com/topic/33635-php-encriptation-question/#findComment-157574 Share on other sites More sharing options...
nadeemshafi9 Posted January 10, 2007 Share Posted January 10, 2007 thats heavey, try doing one at a time first off, and see what you get, concentrate on encrypt first get that to work Link to comment https://forums.phpfreaks.com/topic/33635-php-encriptation-question/#findComment-157636 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.