Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Digest::SHA1 b64digest weirdness
May 10, 2005, 5:33 pm
rate this thread
This is really bizzaro. Here's my code:
$password = "garbage";
my $ctx = Digest::SHA1->new;
my $encpw = "" . $ctx->b64digest . "=";
print STDERR "" . $ctx->b64digest . "=\n";
print STDERR "$encpw\n";
print STDERR "" . ($ctx->b64digest) . "=\n";
But here's the output:
What gives here? Why are these different? Incidentally, the $encpw one
is the correct one.
Re: Digest::SHA1 b64digest weirdness
Did you read the documentation for Digest::SHA1?
Note that the "digest" operation is effectively a destructive,
read-once operation. Once it has been performed, the "Digest::SHA1"
object is automatically "reset" and can be used to calculate
another digest value. Call $sha1->clone->digest if you want to
calculate the digest without reseting the digest state.
Same as $sha1->digest, but will return the digest as a base64
Print the values using $ctx->clone->b64digest and they will be the same.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
- » Upgrading to CPAN.pm v1.76 install Bundle::CPAN fails
- — Next thread in » PERL Modules Announcements