If you want your usernames and passwords to look something like this.....

ªaRtW¢³†Ê¬Ì~“µv$¾ïÃ

then store passwords in a mysql blob field with the encrypt() function and a
"key". I learned this technique from a very excellent tutorial by Aaron
Weiss at the following URL:

www.wdvl.com/Authoring/Languages/Perl/PerlfortheWeb/personalization2.html

If you don't feel like reading through it, I included some of my sample code
below to get you started. Other articles in that same series also include
usage of MD5 for creating checksums. etc.

Ibrahim Dawud

-----------------------------------------------

my ($uname,$pw1) = @_;
my $key1  = 'some_key';
my $key2  = 'some_other_key';

# Reverse password
my @char = split (//,$pw1);
@char = reverse @char;
my $pwR = join "", @char;
my $pwjoin = $pwR . $key2;

my $qry =  qq ( INSERT INTO users_table
VALUES  (encode('$uname','$key1'), encode('$pw1','$pwjoin') ));

my $sth = $dbh->do($qry) or bail_out("Unable to perform DO query");

---------------------------------------------------------------
and then to decode

my ($uname,$pw) = @_;
my $key1  = 'some_key';
my $key2  = 'some_other_key';
my @char = split (//,$pw);
@char = reverse @char;
my $pwR = join "", @char;

my $pwJ = $pwR . $key2;

 $qry =  qq( SELECT  decode(login,'$key1'), decode(pwd,'$pwJ')
                    FROM users_table
                   WHERE decode(login,'$key1')='$uname'
                   AND decode(pwd,'$pwJ')='$pw');

............more code here.....................




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to