<script type="text/ecmascript" src="md5.js"></script>
<script type="text/javascript">
var hash = hex_md5("123dafd");
alert(hash)
</script>
<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);
//解密
str = b.decode(str);
alert("base64 decode:" + str);
</script>
<script type="text/ecmascript" src="sha1.js"></script>
<script type="text/javascript">
var sha = hex_sha1('mima123465')
alert(sha)
</script>
参考: