简体   繁体   English

在Perl中使用Digest :: MD5返回错误的MD5字符串

[英]Returning the wrong MD5 String in Perl with Digest::MD5

I have attempted to encrypt this string with MD5: 我试图用MD5加密此字符串:

lolno

I use the module use Digest::MD5 and my output was: 我使用模块使用Digest :: MD5,我的输出是:

τ;å▌3Gùφ▄♥ H≤Gj╠

I know that this is not MD5 so Id like to ask how I could make this work?Here's the code I used: 我知道这不是MD5,所以我想问一下我该如何做?这是我使用的代码:

use Digest::MD5;
$ctx = Digest::MD5->new;
$ctx->add($pass);
$digest = $ctx->digest;
print $digest;

I also tried: 我也尝试过:

use Digest::MD5 qw(md5);
$test = md5($pass);
print $test;

Try md5_hex ( hexdigest for the first snippet) to see what you seem to expect. 尝试md5_hex (第一个代码片段的md5_hex hexdigest )来了解您的期望。 This is a binary representation presented as characters. 这是表示为字符的二进制表示形式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM