passwd encryption

From: Veera Prasad (VPrasad_at_OLF.COM)
Date: 12/30/04


To: "'dbi-users@perl.org'" <dbi-users@perl.org>
Date: Thu, 30 Dec 2004 11:29:51 -0500

Hi Guys,

I 've used below code to encrypt password using perl module (library) called
'Crypt::PasswdMD5"
and saved it to a file. e.g. "vprasad:$1$121154.6$CeoM.iep2C7nx0ePmUaW10".

use Crypt::PasswdMD5;
$password = 'CrapWork69'; #$ARGV[0];
$salt = rand(999999);
$cryptpasswd = unix_md5_crypt($password, $salt);

And I am using below code to validate the password, but no luck...

use Crypt::PasswdMD5;
$password = 'CrapWork69'; #$ARGV[0];

open (FILE,"<passwd.file") or die "Couldn't open file $!\n";
while ($line = <FILE>) {
   chomp ($line);
   ($user,$cpasswd)=split (":",$line);
}
print "user: $user passwd: $cpasswd\n";
@paarts = split('$', $cpasswd);

$test_crypt = unix_md5_crypt($password, $paarts[2]);
if ($test_crypt eq $cpasswd) {
 print "Password match $test_crypt $cpasswd\n";
} else {
   print "Password does not match please try again\n";
}

Not sure where I am wrong because the password is not matching...

Can Anybody help me...Thanks in Advance...

Veera P Nallamilli
Ph no: 516-394-1295

© 2004 OpenLink Financial

Copyright in this message and any attachments remains with us. It is
confidential and may be legally privileged. If this message is not
intended for you it must not be read, copied or used by you or
disclosed to anyone else. Please advise the sender immediately if
you have received this message in error.

Although this message and any attachments are believed to be free of
any virus or other defect that might affect any computer system into
which it is received and opened, it is the responsibility of the
recipient to ensure that it is virus free and no responsibility
is accepted by Open Link Financial, Inc. for any loss or damage in any
way arising from its use.



Relevant Pages

  • RE: bad file descriptor ..
    ... the files under DBI folder are read-only, ... Copyright in this message and any attachments remains with us. ... which it is received and opened, it is the responsibility of the ... recipient to ensure that it is virus free and no responsibility ...
    (perl.dbi.users)
  • RE: passwd encryption
    ... > Copyright in this message and any attachments remains with us. ... > any virus or other defect that might affect any computer system into ... > which it is received and opened, it is the responsibility of the ... > recipient to ensure that it is virus free and no responsibility ...
    (perl.dbi.users)
  • RE: DBD
    ... > If someone has some info on how I can bundle this up, ... Copyright in this message and any attachments remains with us. ... which it is received and opened, it is the responsibility of the ... recipient to ensure that it is virus free and no responsibility ...
    (perl.dbi.users)
  • Compiling invalid objects using perl DBI
    ... How can supress the above messages while running the program and I am not ... Copyright in this message and any attachments remains with us. ... which it is received and opened, it is the responsibility of the ... recipient to ensure that it is virus free and no responsibility ...
    (perl.dbi.users)
  • Re: SUCCESS_WITH_INFO
    ... error possibly near indicator at char 33 ... Copyright in this message and any attachments remains with us. ... which it is received and opened, it is the responsibility of the ... recipient to ensure that it is virus free and no responsibility ...
    (perl.dbi.users)