PHP处理0e开头md5哈希字符串缺陷/bug

PHP在处理哈希字符串时,会利用”!=”或”==”来对哈希值进行比较,它把每一个以”0E”开头的哈希值都解释为0,所以如果两个不同的密码经过哈希以后,其哈希值都是以”0E”开头的,那么PHP将会认为他们相同,都是0。

关于PHP hash比较缺陷详细介绍:http://www.freebuf.com/news/67007.html 
0x01 md5(str)

QNKCDZO
0e830400451993494058024219903391
 
s878926199a
0e545993274517709034328855841020
 
s155964671a
0e342768416822451524974117254469
 
s214587387a
0e848240448830537924465865611904
 
s214587387a
0e848240448830537924465865611904
 
s878926199a
0e545993274517709034328855841020
 
s1091221200a
0e940624217856561557816327384675
 
s1885207154a
0e509367213418206700842008763514
 
s1502113478a
0e861580163291561247404381396064
 
s1885207154a
0e509367213418206700842008763514
 
s1836677006a
0e481036490867661113260034900752
 
s155964671a
0e342768416822451524974117254469
 
s1184209335a
0e072485820392773389523109082030
 
s1665632922a
0e731198061491163073197128363787
 
s1502113478a
0e861580163291561247404381396064
 
s1836677006a
0e481036490867661113260034900752
 
s1091221200a
0e940624217856561557816327384675
 
s155964671a
0e342768416822451524974117254469
 
s1502113478a
0e861580163291561247404381396064
 
s155964671a
0e342768416822451524974117254469
 
s1665632922a
0e731198061491163073197128363787
 
s155964671a
0e342768416822451524974117254469
 
s1091221200a
0e940624217856561557816327384675
 
s1836677006a
0e481036490867661113260034900752
 
s1885207154a
0e509367213418206700842008763514
 
s532378020a
0e220463095855511507588041205815
 
s878926199a
0e545993274517709034328855841020
 
s1091221200a
0e940624217856561557816327384675
 
s214587387a
0e848240448830537924465865611904
 
s1502113478a
0e861580163291561247404381396064
 
s1091221200a
0e940624217856561557816327384675
 
s1665632922a
0e731198061491163073197128363787
 
s1885207154a
0e509367213418206700842008763514
 
s1836677006a
0e481036490867661113260034900752
 
s1665632922a
0e731198061491163073197128363787
 
s878926199a
0e545993274517709034328855841020


0x02 md5(md5())
 
0x03 md5(md5(str)."SALT")
2
0e774261293712168181959463563504

 

转载于:https://www.cnblogs.com/Primzahl/p/6018158.html

sha碰撞,MD5碰撞实现,#!/usr/local/bin/perl # It was noted that Intel IA-32 C compiler generates code which # performs ~30% *faster* on P4 CPU than original *hand-coded* # SHA1 assembler implementation. To address this problem (and # prove that humans are still better than machines:-), the # original code was overhauled, which resulted in following # performance changes: # # compared with original compared with Intel cc # assembler impl. generated code # Pentium -25% +37% # PIII/AMD +8% +16% # P4 +85%(!) +45% # # As you can see Pentium came out as looser:-( Yet I reckoned that # improvement on P4 outweights the loss and incorporate this # re-tuned code to 0.9.7 and later. # ---------------------------------------------------------------- # Those who for any particular reason absolutely must score on # Pentium can replace this module with one from 0.9.6 distribution. # This "offer" shall be revoked the moment programming interface to # this module is changed, in which case this paragraph should be # removed. # ---------------------------------------------------------------- # $normal=0; push(@INC,"perlasm","../../perlasm"); require "x86asm.pl"; &asm_init($ARGV[0],"sha1-586.pl",$ARGV[$#ARGV] eq "386"); $A="eax"; $B="ecx"; $C="ebx"; $D="edx"; $E="edi"; $T="esi"; $tmp1="ebp"; $off=9*4; @K=(0x5a827999,0x6ed9eba1,0x8f1bbcdc,0xca62c1d6); &sha1_block_data("sha1_block_asm_data_order"); &asm_finish(); sub Nn { local($p)=@_; local(%n)=($A,$T,$B,$A,$C,$B,$D,$C,$E,$D,$T,$E); return($n{$p}); } sub Np { local($p)=@_; local(%n)=($A,$T,$B,$A,$C,$B,$D,$C,$E,$D,$T,$E); local(%n)=($A,$B,$B,$C,$C,$D,$D,$E,$E,$T,$T,$A); return($n{$p}); } sub Na { local($n)=@_; return( (($n )&0x0f), (($n+ 2)&0x0f), (($n+ 8)&0x0f), (($n+13)&0x0f), (($n+ 1)&0x0f)); } sub X_expand { local($in)=@_; &comment("First, load the words onto the stack in network byte order"); for ($i=0; $i<16; $i+=2) { &mov($A,&DWP(($i+0)*4,$in,"",0));# unless $i == 0; &mov($B,&DWP(($i+1)*4,$in,"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值