How can we encrypt the username and password using PHP? ~ Interview Questions & Answers

Monday, March 3, 2008

How can we encrypt the username and password using PHP?

User names and passwords in PHP can be encrypted using md5 function.
MD5 function calculates the md5 hash of a string. It is basically used for encryption. It is also used for digital signature applications, where a large file must be "compressed" in a secure manner.
Example:
Md5($str);
Crypt() function can also be used to encrypt a string,. It used MD5, DES or blow fish algorithms for encryption.
Syntax:
Crypt(str, salt)
Salt is an optional parameter used to increase the number of characters encoded, to make the encoding more secure

0 comments: