After thinking about it for a minute, I don't think that would work. Basically, you have an 128 bit integer in binary form and you are then converting the first 64 bits of it into decimal form. I'm pretty sure a hex digest isn't going to help here because you can't simply just cut it in half.
That seems to be what unpack('q', md5($foo)) is doing - cutting the digest in half.
use Digest::MD5 'md5'; my $foo = 'hello, world!'; my @v = unpack('q', md5($foo)); printf "%x %x\n", @v;
$ perl unpackq.pl e3ba1f79d1badb3a 0
If you really need to convert the whole digest to an integer, try Math::BigInt->from_hex(md5_hex($foo))
In reply to Re^7: Equivalent of unpack 'q' with 32-bit Perl (a8)
by RonW
in thread Equivalent of unpack 'q' with 32-bit Perl
by Limbic~Region
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |