Digest::MD5 问题,用函数和用OO得出的结果不一样 请班主删除此贴

Digest::MD5 问题,用函数和用OO得出的结果不一样 请班主删除此贴

#!/usr/bin/perl -w
use Digest::MD5 qw(md5 md5_hex md5_base64);
$data='A';
        $digest = md5($data);
        print $digest,"\n";

        $digest = md5_hex($data);
        print $digest,"\n";

        $digest = md5_base64($data);
        print $digest,"\n";

print "*"x40,"\n";

        $ctx = Digest::MD5->new;
open(FHD,"+>>abc.txt"
        or die "$!\n";

        $ctx->add($data);
#        $ctx->addfile(FHD);
        $digest = $ctx->digest;
        print $digest,"\n";
        $digest = $ctx->hexdigest;
        print $digest,"\n";
        $digest = $ctx->b64digest;
        print $digest,"\n";

Name "main::FHD" used only once: possible typo at md5.pl line 16.
▒bp▒▒Y5▒.▒&#9618
7fc56270e7a70fa81a5935b72eacbe29
f8VicOenD6gaWTW3Lqy+KQ
****************************************
▒bp▒▒Y5▒.▒&#9618
d41d8cd98f00b204e9800998ecf8427e
1B2M2Y8AsgTpgAmY7PhCfg

这个base64和mime::base64有何不同

自己D一下,哪个大大提下呀
没人回答,请班主把这个贴子删了吧,谢谢
pod

[Copy to clipboard] [ - ]
CODE:
       $md5->digest
           Return the binary digest for the message.  The returned string will be 16 bytes long.

           Note that the "digest" operation is effectively a destructive, read-once operation. Once it has been performed, the
           "Digest::MD5" object is automatically "reset" and can be used to calculate another digest value.  Call $md5->clone->digest if
           you want to calculate the digest without resetting the digest state.