我正在使用代码 $ enrypt = md5($ pass)并将 $ encrypt 插入数据库。我想找出解密方法。我尝试使用解密软件,但它说哈希应该是正好16个字节。有没有办法解密它或使它成为一个16字节的MD5散列?
我的散列看起来像这样: c4ca4238a0b923820dcc $ c $如前所述,如果不尝试类似暴力破解这样的资源密集型,不实用的解密方式,就不能解密MD5 ,而且是不道德的。
然而,您可以使用类似的方式安全地加密/解密密码/ etc:
$ input =SmackFactory; $ encrypted = encryptIt($ input); $ decrypted = decryptIt($ encrypted); echo $ encrypted。 '< br />'。 $解密; 函数encryptIt($ q){ $ cryptKey ='qJB0rGtIn5UB1xG03efyCp'; $ qEncoded = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256,md5($ cryptKey),$ q,MCRYPT_MODE_CBC,md5(md5($ cryptKey)))); return($ qEncoded); } 函数decryptIt($ q){ $ cryptKey ='qJB0rGtIn5UB1xG03efyCp'; $ qDecoded = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256,md5($ cryptKey),base64_decode($ q),MCRYPT_MODE_CBC,md5(md5($ cryptKey))),\0); return($ qDecoded); $ b使用加盐的加密方法更安全,下一步就是使用MD5散列。I am using code $enrypt=md5($pass) and inserting $encrypt to database. I want to find out a way to decrypt them. I tried using a decrypting software but it says the hash should be of exactly 16 bytes. is there any way to decrypt it or to make it a 16 byte md5 hash?
My hash looks like this: c4ca4238a0b923820dcc
解决方案As already stated, you cannot decrypt MD5 without attempting something like brute force hacking which is extremely resource intensive, not practical, and unethical.
However you could use something like this to encrypt / decrypt passwords/etc safely:
$input = "SmackFactory"; $encrypted = encryptIt( $input ); $decrypted = decryptIt( $encrypted ); echo $encrypted . '<br />' . $decrypted; function encryptIt( $q ) { $cryptKey = 'qJB0rGtIn5UB1xG03efyCp'; $qEncoded = base64_encode( mcrypt_encrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), $q, MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ) ); return( $qEncoded ); } function decryptIt( $q ) { $cryptKey = 'qJB0rGtIn5UB1xG03efyCp'; $qDecoded = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), base64_decode( $q ), MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ), "\0"); return( $qDecoded ); }Using a encypted method with a salt would be even safer, but this would be a good next step past just using a MD5 hash.
更多推荐
加密和解密md5
发布评论