Created
February 2, 2012 13:51
-
-
Save juhasz/1723555 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $key = '123123'; | |
| $data_str = '8PAYUDEMO42578192011-06-15 17:05:5513CD lejátszó12Fejhallgató5CDPLY6CSTAUD10Adapterrel04250033501111101034503HUF2108Budapest4Pest2HU8CCVISAMC'; | |
| $b = 64; // byte length for md5 | |
| if (strlen($key) > $b) { | |
| $key = pack("H*",md5($key)); | |
| } | |
| $key = str_pad($key, $b, chr(0x00)); | |
| $ipad = str_pad('', $b, chr(0x36)); | |
| $opad = str_pad('', $b, chr(0x5c)); | |
| $k_ipad = $key ^ $ipad; | |
| $k_opad = $key ^ $opad; | |
| $hash = md5($k_opad . pack("H*",md5($k_ipad . $data_str))); | |
| $hash == 'e57255db079028b8f1a5660736279212'; // TRUE // ezt dobja a program... | |
| $hash == '9d345e8b3e4085c1a7eea6f106273322'; // FASLE // a doksi szerint ennek kellene lenie... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment