Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
# get a list of all the encoded passwords however your program does it and put them into an array like this:
@des;
# assuming every passwd has the same passphrase to encode it...
use TripleDes;
use Digest::MD5 qw(md5_hex);
my $cipher = new TripleDes;
my @md5 = (); # where the md5 passes will go
foreach my $encoded (@des) {
my $decoded = $cipher->decrypt3 ($encoded,$passphrase);
my $newMD5 = md5_hex ($decoded);
push (@md5,$newMD5);
}
$dbh = a database handle
#...
use TripleDes;
use Digest::MD5 qw(md5_hex);
my $cipher = new TripleDes;
my $query = $dbh->prepare (q~
SELECT user,pass FROM users
~);
$query->execute();
while (my $row = $query->fetchrow_hashref) {
my $user = $row->{user};
my $pass = $row->{pass}; # their DES encoded passwd
# decode their pass
my $clear = $cipher->decrypt3 ($pass,"secret passphrase");
# md5 encode it
my $md5 = md5_hex ($clear);
# update the table
my $up = $dbh->prepare (q~
UPDATE users SET pass=? WHERE user=?
~);
$up->execute ($md5, $user);
}
I appreciate your motives, but generally there's more to it than just posting a huge chunk of code on a web site and saying "somebody fix it for me". We're normally fairly altruistic on this forum, but we are here to help, not to do your job for you. If you'd at least made some effort to look at the code (ok, so you don't know Perl, but I'm assuming you can map some other programming knowledge onto it) and maybe isolate the subroutine it would have helped.joopster said:I was trying to help someone else out.