I need to generate MD5 password from provided informations. Following is my MySQL database table;
sN | firstN | lastN | countryN | dob | emailID | joinD | uID | passwd |
------------------------------------------------------------------------------------------------------
1 | Roger | Federer | German | 1981-08-08 | rfederer@gmail.com | 2009-12-23 |40345689 | ???????? |
| | | | | | | | |
Generated password should be like this:
<first two characters from lastN> + <dob month> + <dob day> + <last two digit from uID> + "=$"
In this case;
Password : "Fe080889=$"
Encrypted Password : "d76c30608603f7bf0a07abb03c6a631f"
Please somebody help me with this. How do I do it using bash script or is there any way to do it itself in MySQL?
You can do this in MySQL (depending on your version). It has built-in encryption/checksum functions:
http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html#function_md5
Just use a combination of substring and date-parsing functions to concatenate the pieces of the fields you need, and pass the string through
MD5().Roughly: