Convert a plain password in a field in mysql into md5 format

Problem : wanna convert a plain password in a field in mysql into md5 format
Solution :
1. export mysql selected field to text
2. convert field md5

hows? ok start

solution 1 :

SELECT password INTO OUTFILE ‘C:/result.txt’
LINES TERMINATED BY ‘\n’
FROM users;

explanation :
– password : the field u want to export
-users the table

solution 2 :

make a php file one folder with u’r result, then create this

<?php
function tep_encrypt_password($plain){
$salt = substr(md5(uniqid(rand(), true)), 0, 9);
$password = md5($salt.$plain).’:’.$salt;
return $password;
}

$passes = file(‘result.txt’);

foreach($passes as $key => $pass){
$line = explode(” “, $pass);
// the password is in $line[1], the email is in $line[0]
$line[1] = tep_encrypt_password($line[1]);
$passes[$key] = implode(” “, $line);
}
$passes = implode(“\n”, $passes);
file_put_contents(‘result2.txt’, $passes);

?>

Leave a Comment

Your email address will not be published. Required fields are marked *