0

Hi there,

please help me to write script encryption/decryption in php?
i am using below code for my encryption/decryption ...
Please tell your suggesstions if there is security issues in this script.
thanks..

$key_value = "prtiv24$";    
$plain_text = "password"; 
$encrypted_text = mcrypt_ecb(MCRYPT_DES, $key_value, $plain_text, MCRYPT_ENCRYPT); // password encryption 
echo ( $encrypted_text ); 
$decrypted_text = mcrypt_ecb(MCRYPT_DES, $key_value, $encrypted_text, MCRYPT_DECRYPT); 
echo ("<p><b> Text after decryption : </b>"); 
echo ( $decrypted_text ); 

Edited by fireburner29: mistaken

2
Contributors
2
Replies
29
Views
2 Years
Discussion Span
Last Post by fireburner29
2

Hi,

just a note: the mcrypt_ecb() function is deprecated since PHP 5.5, it means this is going to be removed. You should use mcrypt_generic()and mdecrypt_generic() as explained in the documentation:

For some information about the encryption modes check those available:

I would use CBC rather than EBC, because with EBC is possible to find patterns and it is possible to alter the encrypted string to obtain something else. This article explains the issue very well:

Bye!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.