RE: md5 encryption.
perldoc Digest::MD5 This is the module you want to use. -Original Message- From: Christopher Burger [mailto:chris@;burgerfamily.net] Sent: Wednesday, November 13, 2002 10:23 AM To: [EMAIL PROTECTED] Subject: md5 encryption. Just a quick question. How can encrypt something with md5 encryption. I have passwords in a mysql database that are md5 encrypted. I was wondering if I can use something like $password = md5($input{'password'}; to get the input encrypted and then check against the sql field for proper login. Appreciate any help, thanks. Chris Burger -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: md5 encryption.
on wo, 13 nov 2002 18:23:15 GMT, Christopher Burger wrote: > Just a quick question. How can encrypt something with md5 encryption. > I have passwords in a mysql database that are md5 encrypted. I was > wondering if I can use something like > > $password = md5($input{'password'}; > > to get the input encrypted and then check against the sql field for > proper login. You could use the md5_hex function from Digest::MD5, but there is another way without the need for this module. Suppose you have the following table definition: CREATE TABLE users ( username CHAR(10) NOT NULL PRIMARY KEY, password CHAR(32) NOT NULL ); You can then insert new users with my $sth_add_user = $dbh->prepare( qq{ INSERT INTO users VALUES (?, md5(?))') }); $sth_add_user->execute('Chris', 'Burger'); And you can check whether ($user, $pass) is a valid combination with my $sql_check_password = qq{ SELECT username FROM user WHERE username = ? AND md5(?) = password }; my ($username) = $dbh->selectrow_array($sql_check_password, undef, $user, $pass); if (defined $username) { # OK } else { # Not OK } -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: md5 encryption.
look up Crypt::PasswdMD5 on CPAN. I use the same module, no problems. dan "Christopher Burger" <[EMAIL PROTECTED]> wrote in message news:!~!UENERkVCMDkAAQACABgAQQZ01V1XZUy+ZLRflK79TcKA [EMAIL PROTECTED] Just a quick question. How can encrypt something with md5 encryption. I have passwords in a mysql database that are md5 encrypted. I was wondering if I can use something like $password = md5($input{'password'}; to get the input encrypted and then check against the sql field for proper login. Appreciate any help, thanks. Chris Burger -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]