标签: md5

python md5,d.update(strParam).hexdigest()返回NoneType.=,为什么?

>>> d = md5.new()
>>> d.update('a').hexdigest()
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'hexdigest'
Run Code Online (Sandbox Code Playgroud)

这会工作 -

>>> d = md5.new()
>>> d.update('a')
>>> d.hexdigest()
'0cc175b9c0f1b6a831c399e269772661'
Run Code Online (Sandbox Code Playgroud)

是否有缩短python代码的解释?

python md5

0
推荐指数
1
解决办法
4318
查看次数

MD5盐登录系统

嘿家伙我正在尝试建立一个使用MD5加密密码的登录系统.我有加密工作,所有这只是出于某种原因,当我在登录页面输入密码"palmer"并点击登录按钮我发送给我一个页面,它告诉我加密密码和使用"palmer"作为它输出的密码"Duncan使用密码登录4844fd4088ef5278ad18f892808ebda8 - palmer".加密时数据库中的密码是"4669a6b46c8d891b373cfcd664dff6".为什么两个密码不同?我使用相同的盐(盐是"a123b123".

下面是我的代码,它在寄存器上加密密码:

$password = $_POST['password'];

$md5pass = md5($salt.md5($password));
Run Code Online (Sandbox Code Playgroud)

以下是我的登录代码.

<?php
session_start();
include('config/config.php');

$email = $_POST['email'];
$password = $_POST['password'];
$pass2 = md5($salt.md5($password));

$check = mysql_query("SELECT `email`,`password` FROM user WHERE (`email`='$email' AND       `password`='$pass2')") or die(mysql_error());

$count = mysql_num_rows($check);

//if($count == 1) {
$_SESSION['user'] = strtoupper($user);
//header('Location: /panel/index.php');
echo("Duncan Logged in using password $pass2 - $pass");
//} else {
//$_SESSION['errormsg'] = "<div id='error'><strong>Error:</strong> Invalid Username or Password!</div>";
//header('Location: index.php');
//}
?>
Run Code Online (Sandbox Code Playgroud)

php md5 login system

0
推荐指数
1
解决办法
8388
查看次数

将NSDecimalNumber转换为NSString

我使用此代码获取md5字符串哈希

- (NSString *) md5:(NSString *) input
{
    const char *cStr = [input UTF8String];
    unsigned char digest[16];
    CC_MD5( cStr, strlen(cStr), digest ); // This is the md5 call

    NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];

    for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
        [output appendFormat:@"%02x", digest[i]];

    return  output;
}
Run Code Online (Sandbox Code Playgroud)

当我这样做时,它完美无缺

[self md5:@"mystring"];
Run Code Online (Sandbox Code Playgroud)

但是当我这样做的时候

[self md5:userId];
Run Code Online (Sandbox Code Playgroud)

我有一个错误

因未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:' - [NSDecimalNumber UTF8String]:无法识别的选择器发送到实例0x61a7080'

userId是一个NSString

NSString *userId; @property(retain,nonatomic) NSString *userId;
Run Code Online (Sandbox Code Playgroud)

但它会影响facebook的用户ID,就像我尝试过的"3309843"

[self md5:[userId stringValue]]];
Run Code Online (Sandbox Code Playgroud)

我仍然有同样的错误

更新 我试过这个

[self md5:@"980232376"];
Run Code Online (Sandbox Code Playgroud)

仍然有相同的错误,我认为问题是方法md5.我不能得到一串数字的md5?

cocoa-touch md5 objective-c nsdecimalnumber ios

0
推荐指数
1
解决办法
2921
查看次数

解密md5 iphone

我正在使用以下代码使用md5加密字符串

const char* str = [@"123456" UTF8String];
unsigned char result[CC_MD5_DIGEST_LENGTH];
CC_MD5(str, strlen(str), result);

NSMutableString *ret = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH*2];
for(int i = 0; i<CC_MD5_DIGEST_LENGTH; i++) {
    [ret appendFormat:@"%02x",result[i]];
}
NSLog(@"%@", ret);
Run Code Online (Sandbox Code Playgroud)

现在我想要一个源代码来解密编码的字符串,Any Help?

iphone md5 ipad ios

0
推荐指数
1
解决办法
1803
查看次数

这件PHP有什么作用?(密码解密)

可能重复:
我可以md5(sha1(密码))?

$pass = md5($_POST["pass"].sha1($_POST["pass"]))
Run Code Online (Sandbox Code Playgroud)

我在某个地方看到这个并且感到困惑.这是否读取密码并使用sha1然后md5或反向解密?还是有一些我遗失的东西?

php encryption passwords md5 sha1

0
推荐指数
2
解决办法
174
查看次数

Is MD5 still considered secure for single use authentications?

Everyone is shooting down MD5 these days for its issues in the context of storing passwords. But what about uses where I just want to add a layer of authentication to something that will likely be used once?

This is just a hypothetical example, but let's say I have a feature to allow a user to reset their password. I email the user a link that they can click to set a new (randomly-generated) password.

My current thinking is that …

security md5 sha1

0
推荐指数
1
解决办法
2577
查看次数

MD5 Hashing返回的输出不同于预期

我使用JDBC连接灯和我有字LondonWeight作为密码MySQL数据库使用MD5加密.然后,我需要检查输入的密码,即LondonWeight检查它们是否匹配.但是,我的Java代码中的散列为该单词返回不同的输出.

MySQL哈希:1274d1c52d7a5a9125bd64f1f9a26dce

Java哈希:132310771724320562704545645352563257040366

这是我的哈希码:

private String hashPass(String pass) throws NoSuchAlgorithmException {
    MessageDigest mdEnc = MessageDigest.getInstance("MD5"); 
    mdEnc.update(pass.getBytes(), 0, pass.length());
    String md5 = new BigInteger(1, mdEnc.digest()).toString(8); // Encrypted 
    return md5;
}
Run Code Online (Sandbox Code Playgroud)

它肯定会散列在文本框中输入的字符串,因为我将它打印到终端,所以我可以检查.知道为什么它会提供不同的输出吗?我理解有不同的方法来散列字节或其他东西?

java md5 jdbc

0
推荐指数
1
解决办法
434
查看次数

文件哈希算法的性能

在我的Perl应用程序中,我需要比较文件的两个版本并检测它们是否已更改.

我正在尝试在MD5或SHA之间进行选择.这与安全无关.这是比较文件的最快方法.我倾向于MD5.

但是,当我运行基准测试时,它表示不然.

有什么建议?

这是我在应用程序中使用最大文件运行的基准测试.

Benchmark: timing 10000000 iterations of MD5, SHA...
   MD5: -0.199009 wallclock secs ( 0.07 usr +  0.01 sys =  0.08 CPU) @ 125000000.00/s (n=10000000)
        (warning: too few iterations for a reliable count)
   SHA: 0.494412 wallclock secs ( 0.06 usr +  0.00 sys =  0.06 CPU) @ 166666666.67/s (n=10000000)
        (warning: too few iterations for a reliable count)
       Rate  MD5  SHA
MD5 125000000/s   -- -25%
SHA 166666667/s  33%   --
Run Code Online (Sandbox Code Playgroud)

perl benchmarking md5 sha filecompare

0
推荐指数
1
解决办法
550
查看次数

此代码对密码散列有效吗?

这是一个有效的盐生成代码.如果它无效,它会怎么做然后请解释我应该做什么,请稍微减少一点技术我只有15

$password='123'//test password
$salt=openssl_random_pseudo_bytes(rand());//generate salt
$prehash_password=hash('sha512',$password);//pre hash the password 
$final_password=hash('sha512',$password.$salt)//generate the final password
Run Code Online (Sandbox Code Playgroud)

结果....(太长了所以裁剪它)

=m]ˆÂýÇâ&-Ù©Þ}§˜ü=l|‹|oÓÌ×±[ý’p'lJÛ|›¦nXÝx܆9óÔ¢¤ÿ‰"µ^¾õJ JI^íó,•±†û½L›T0*Stÿ#s´Ë§ÔMgå.£J§èeRzù/‡üœ¿ª¡ ǹáuT¯ '0¯ÄŒÐ²A@ü •uuYRpýš™ü5%P—í¬ïr‚×ODÜ—´“„?”öÛž;Bí#Þcõ&¾qLEâ« |Z¯ÔÐö%R•9âǸ—•êäxZ³ÎɶÉêS\™!qóœ[)ÚúÞçøƒŠº¾*Ü/X"Œê@µð¶¨$p1£B5iÚ Ú†õʬɦE3^ür¾auD»ëêA)d„ÏHzYÁepƒê¬~ô¡œ8e‡ñˆÖM&èæ<ëâM"-¹uSÂÖøsBŒiÓÑ!³ÊÅwÛö>kHåO'dyÁ(<Ýx´Ÿì¸¤˜)èÀ©@ëQæ‚Ëã:04q-‡è—žÄ­"tÌÀ±IŒW1p–̇bïV¢¼-$»¥ˆlË*Ê^¡´ZK ×±›mßhœôNþ`‰û§4p9 þ]Ùö®u*)ú24qØI£–]†#8kÐ>a…t fö¾¶+k—a ?L¯¶ƒÎµÜz‘k†—)+¥qþÞ \®qÔª|ãO¹¥ô?I°®íɨ‘‡3 dÿë€ìV&"+Ï}*L퀟h"p  Ø"ð¶Øäç6ˆkƒ¹òÓ@FK²Ä?åüï<:CˆšÛƒ1J®b™ý)žy´ÔĶa™_Áïx^—õö6Ãqc€õš¾©÷M—¡å´7ÁÑ©Nà›¶AÚ¢öEM:"¶Ž4iáîµ&Cþ²Pû¶££.ÿ *?©ñÞ`&ÞGøó§¦_B¸‡h–¦éÞæ'裩n¥êý5‘¿kcñV‰1?xçÛ#”C0ÒÁià¿0Ÿ¥çWdŘ]íhæS'ã'–ÿðò§ü‡ì¨šãfïï Á0ó7kÀ%±N“£\Br)"úkl슢˜˜[’€:º–Í  GaùÛaçˆwsÔÚ‚õòSd›±ltWZ›è_¹ªÿã§%ÉÞxŸKÊMUYÜJ@Šý+BBL¤®Š±    „¼‚ÈûæÀŠBñã“„º/oú–·fJäƒrÀ°‡¤N2¸×kìô"aõÙ%ÚÂWŸÿ–†Œ»Còc?…£Rw4ËZ_W§{b™”î—/ľ›:ºj;U.½ÓM “É¥8T37?¿UÃh5Ľ>éÎÔášÄxÀ¥ä·$í÷äÕÖ·¿Oowç<ÖÅ!XNâjW”öb1GâÔ¯yYÇ+¶pL´[sŠÍT.×KXNK“kh-ñ@bÌÜ^Ü÷]é ¿}fkøD‡0GE îŽï˜;pÂsжZfÀ§1gjõÂcøwãj•‡'BšÓ{»£¬²BhaA2ÿT Ë~S{‹øÏàïnñhÁn ýˆÜzŽ*`5ÉŽAsqaùðĶü¿ƒ 5g>ë¥Uå!-£SÂr–ELÿ*à&;½¤&›y™Ž6¼³ªø ȮMP÷G©‹:ø_•ÜAaA«jb;‹¨ÓŠĹ‰¤¼l*S ï?ö„óÑ    žsÌ=,&å x— a´è2éòyÄlÝŠ*žÄ¥ÆnÀ¨ã³¡ ÝòÆFƒDÁ*D   ;™±™½fÀßÃ¥‹{â«ZËÅøÁY‚Œ”².—ÆÀMuüÃÙR™;c6ì€Î®û°Éƒ„bЖ{íWáßõíì’¬¾ßaÙ°^læ¿r{ƒ,ãaì?ZÞ‚á>m9‚€’ѧÑú\VFÏ\b¶c'E¨)óå€Â˜¾bæ¿;nðî¶Äê=fè8cÊ©"¹K sF¢Æš³   ²ˆô6*®&Øç$î6ÐZÆú”Ž‹S¹)šå‡j¶ý¥¹3áBy+ìç°ÏHHg®™:ä`Oà^4Æ–(Øx$…ÖýdÎÞfvr"ÙCU¼Áë¸;½›ÂMy.fRlÓûñ9HÕ6V•.–‚“3¬ig_HSÀíñæ…ïþ­qž—7¾_;ó«(«ãøguBš"ã·pÓïvŠªÜ²•tÚÒ=Jî„d|¤MxžŠÝ’Œ>`
Run Code Online (Sandbox Code Playgroud)

php md5 salt sha512

0
推荐指数
1
解决办法
97
查看次数

DigestUtils md5Hex的问题

我使用org.apache.commons.codec.digest.DigestUtils.md5Hex() Apache-Commons-Codec来计算连接字符串的mD5,但是我得到相同字符串的不同mD5哈希码值.

我看到以下输出,我的期望是它对于给定的字符串是相同的,但看起来不是.问题是什么?

我使用以下代码生成MD5 Hashcode,我在centos平台上.

    if (StringUtils.isNotBlank(concatenatedString)) {

        concatenatedString = StringUtils.deleteWhitespace(concatenatedString);
        //System.out.println("The concatenated string is "+concatenatedString);

        md5Hash = DigestUtils.md5Hex(concatenatedString);
        //System.out.println("The mD5 hashcode is  "+md5Hash);

    }
Run Code Online (Sandbox Code Playgroud)

输出:

The concatenated string is JaclynSmith Women'sComfortDressPumpTori-Blackhttp://www.kmart.com/jaclyn-smith-women-s-comfort-dress-pump-tori-black/p-035VA51352201P//clothing-shoes-jewelry/b-1325032682?sbf=Brand&sbv=Jaclyn+SmithProductDescriptionWhetheryourlookisdressyorcasual,addaclassictouchwiththesewomen'sToripumpsbyJaclynSmith.Theseshoesfeatureshinypatent-lookuppersandwrapped,medium-heightheels.Comfortablecushionedinsolesprovideextrasupportwhiletexturedrubberoutsolesaddanon-slipfit,makingtheseround-toepumpsperfectforeverydayofficewearoraformalnightout.Slip-ondesignSyntheticleatherupperRoundtoeCushionedinsoleTexturedrubberoutsole3-in.wrappedheelCare:WipecleanImportedif(isI18NConvReq()){$("#desca").hide();}24.99http://c.shld.net/rpx/i/s/i/spin/image/spin_prod_1001427212?hei=315&wid=315&op_sharpen=1&resMode=sharp&op_usm=0.9nullKmarthttp://www.kmart.com/jaclyn-smith-women-s-comfort-dress-pump-tori-black/p-035VA51352201P//clothing-shoes-jewelry/b-1325032682?sbf=Brand&sbv=Jaclyn+Smithnullnull
The mD5 hashcode is  f20bd1bbd0063672e89d688268df0556

The concatenated string is JaclynSmith Women'sComfortDressPumpTori-Blackhttp://www.kmart.com/jaclyn-smith-women-s-comfort-dress-pump-tori-black/p-035VA51352201P//clothing-shoes-jewelry/b-1325032682?sbf=Brand&sbv=Jaclyn+SmithProductDescriptionWhetheryourlookisdressyorcasual,addaclassictouchwiththesewomen'sToripumpsbyJaclynSmith.Theseshoesfeatureshinypatent-lookuppersandwrapped,medium-heightheels.Comfortablecushionedinsolesprovideextrasupportwhiletexturedrubberoutsolesaddanon-slipfit,makingtheseround-toepumpsperfectforeverydayofficewearoraformalnightout.Slip-ondesignSyntheticleatherupperRoundtoeCushionedinsoleTexturedrubberoutsole3-in.wrappedheelCare:WipecleanImportedif(isI18NConvReq()){$("#desca").hide();}24.99http://c.shld.net/rpx/i/s/i/spin/image/spin_prod_1001427412?hei=315&wid=315&op_sharpen=1&resMode=sharp&op_usm=0.9nullKmarthttp://www.kmart.com/jaclyn-smith-women-s-comfort-dress-pump-tori-black/p-035VA51352201P//clothing-shoes-jewelry/b-1325032682?sbf=Brand&sbv=Jaclyn+Smithnullnull
The mD5 hashcode is  a0f99dca82fa3b3be846a9896614df9b

The concatenated string is JaclynSmith Women'sComfortDressPumpTori-Blackhttp://www.kmart.com/jaclyn-smith-women-s-comfort-dress-pump-tori-black/p-035VA51352201P//clothing-shoes-jewelry/b-1325032682?sbf=Brand&sbv=Jaclyn+SmithProductDescriptionWhetheryourlookisdressyorcasual,addaclassictouchwiththesewomen'sToripumpsbyJaclynSmith.Theseshoesfeatureshinypatent-lookuppersandwrapped,medium-heightheels.Comfortablecushionedinsolesprovideextrasupportwhiletexturedrubberoutsolesaddanon-slipfit,makingtheseround-toepumpsperfectforeverydayofficewearoraformalnightout.Slip-ondesignSyntheticleatherupperRoundtoeCushionedinsoleTexturedrubberoutsole3-in.wrappedheelCare:WipecleanImportedif(isI18NConvReq()){$("#desca").hide();}24.99http://c.shld.net/rpx/i/s/i/spin/image/spin_prod_1001427112?hei=315&wid=315&op_sharpen=1&resMode=sharp&op_usm=0.9nullKmarthttp://www.kmart.com/jaclyn-smith-women-s-comfort-dress-pump-tori-black/p-035VA51352201P//clothing-shoes-jewelry/b-1325032682?sbf=Brand&sbv=Jaclyn+Smithnullnull
The mD5 hashcode is  b298e7b5af0af3004a078a5c88ab9b09

The concatenated string is JaclynSmith Women'sComfortDressPumpTori-Blackhttp://www.kmart.com/jaclyn-smith-women-s-comfort-dress-pump-tori-black/p-035VA51352201P//clothing-shoes-jewelry/b-1325032682?sbf=Brand&sbv=Jaclyn+SmithProductDescriptionWhetheryourlookisdressyorcasual,addaclassictouchwiththesewomen'sToripumpsbyJaclynSmith.Theseshoesfeatureshinypatent-lookuppersandwrapped,medium-heightheels.Comfortablecushionedinsolesprovideextrasupportwhiletexturedrubberoutsolesaddanon-slipfit,makingtheseround-toepumpsperfectforeverydayofficewearoraformalnightout.Slip-ondesignSyntheticleatherupperRoundtoeCushionedinsoleTexturedrubberoutsole3-in.wrappedheelCare:WipecleanImportedif(isI18NConvReq()){$("#desca").hide();}24.99http://c.shld.net/rpx/i/s/i/spin/image/spin_prod_1001427312?hei=315&wid=315&op_sharpen=1&resMode=sharp&op_usm=0.9nullKmarthttp://www.kmart.com/jaclyn-smith-women-s-comfort-dress-pump-tori-black/p-035VA51352201P//clothing-shoes-jewelry/b-1325032682?sbf=Brand&sbv=Jaclyn+Smithnullnull
The mD5 hashcode is  ffbaf47555d495b818426cc514e24c77
Run Code Online (Sandbox Code Playgroud)

java md5 apache-commons-codec

0
推荐指数
1
解决办法
685
查看次数