Introduce the Base64.js file to the page and call the method:
<! DOCTYPE html>
<meta charset= "Utf-8" >
<TITLE>BASE64 Encryption </title>
<script type= "Text/javascript" src= "Base64.js" ></script>
<script type= "Text/javascript" >
var B = new Base64 ();
var str = b.encode ("Admin:admin");
Alert ("Base64 encode:" + str);
Decrypt
str = B.decode (str);
Alert ("Base64 decode:" + str);
</script>
<body>
</body>
2, MD5 encryption
Refer to the Md5.js file in the page, calling the method
<! DOCTYPE html>
<meta charset= "Utf-8" >
<TITLE>MD5 Encryption </title>
<script type= "Text/ecmascript" src= "Md5.js" ></script>
<script type= "Text/javascript" >
var hash = hex_md5 ("123dafd");
Alert (hash)
</script>
<body>
</body>
3, SHA1 encryption
It's said to be the safest encryption.
The sha1.js is introduced into the page, and the method is called
<! DOCTYPE html>
<meta charset= "Utf-8" >
<TITLE>SHA1 Encryption </title>
<script type= "Text/ecmascript" src= "Sha1.js" ></script>
<script type= "Text/javascript" >
var sha = hex_sha1 (' mima123465 ')
Alert (SHA)
</script>
<body>
</body>
Base64.js
Md5.js
Sha1.js
Excerpt from: JS for password encryption
JS for password encryption