Home > Article > Web Front-end > A simple way to implement MD5 encryption with jQuery
This article mainly introduces jQuery's simple method of implementing MD5 encryption. It implements the md5 encryption function based on the jquery.md5.js plug-in. It is very simple and practical. Friends who need it can refer to it. I hope it can help everyone.
1. Problem background
There are two input boxes, one input box is plain text, and the other input box displays cipher text
2. Implementation source code
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>jQuery实现MD5加密</title> <script type="text/javascript" src="js/jquery-1.12.4.js" ></script> <script type="text/javascript" src="js/jquery.md5.js" ></script> <script> $(function(){ $("#before").blur(function(){ var before = $(this).val(); var beforeVal = $.md5(before); $("#after").val(beforeVal); }); }); </script> </head> <body> <p> <input type="text" id="before" style="width: 300px;"/><br><br> <input type="text" id="after" style="width: 300px;"/> </p> </body> </html>
3. Implementation result
Related recommendations:
Oracle defines DES encryption, decryption and MD5 encryption function examples
Detailed explanation of base64 encryption, md5 encryption and sha1 encryption implemented by JS
The above is the detailed content of A simple way to implement MD5 encryption with jQuery. For more information, please follow other related articles on the PHP Chinese website!