I've not had much problems with the digest, even on mp2. This is a wild
shot, but have you tried the OO version of the digest:
$sha1 = Digest::SHA1->new;
$sha1->add($data);
$digest = $sha1->hexdigest;
Wiswell, Virginia wrote:
Has anyone else ever experienced inconsistencies in digest creation
using the same plaintext? I am encrypting passwords with Digest::SHA1's
sha1_hex function and storing them in a db. When someone logs in, I take
the password, encrypt it the same way and then compare it with the
stored digest. After a few days, Digest::SHA1 starts creating a
different digest for the identical password. Needless to say, this makes
my login process unusable.
I am using this in a web app, but I don't see this as a web problem:
Win2k, IIS 5, ASP using perlscript. The code below is in a module I
created. It used to work fine a year or two ago. Windows was recently
patched, but I don't see how that could affect this.
My code:
sub compareDigest
{
($vi_acct,$vi_data)= @_;
use Digest::SHA1('sha1_hex');
$vi_digest = sha1_hex($vi_data);
$sth = $dbh->prepare( qq{ SELECT id, digest FROM mytable
WHERE id = '$vi_acct' AND digest = '$vi_digest' } );
$sth->execute();
...
--------------- this is how I initially create the digest to save in the
db
sub createDigest
{
($dp_acct,$dp_data)= @_;
use Digest::SHA1('sha1_hex');
$dp_digest = sha1_hex($dp_data);
$sth = $dbh->prepare(qq{ INSERT INTO mytable (id, digest) VALUES
('$dp_acct', '$dp_digest')} );
$sth->execute();
...
Truly baffled,
virginia
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs