加密和解密md5

编程入门 行业动态 更新时间:2024-10-26 12:28:34
本文介绍了加密和解密md5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用代码 $ enrypt = md5($ pass)并将 $ encrypt 插入数据库。我想找出解密方法。我尝试使用解密软件,但它说哈希应该是正好16个字节。有没有办法解密它或使它成为一个16字节的MD5散列?

我的散列看起来像这样: c4ca4238a0b923820dcc

然而,您可以使用类似的方式安全地加密/解密密码/ 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

本文发布于:2023-10-25 00:02:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1525368.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!