这里使用blueimp的JavaScript-MD5实现Javascript进行MD5加密。
1.引用md5.min.js
<script src="js/md5.js"></script>
2.使用
// Calculate the (hex-encoded) MD5 hash of a given string value:
var hash = md5('value') // "2063c1608d6e0baf80249c42e2be5804"
//Calculate the (hex-encoded) HMAC-MD5 hash of a given string value and key:
var hash = md5('value', 'key') // "01433efd5f16327ea4b31144572c67f6"
//Calculate the raw MD5 hash of a given string value:
var hash = md5('value', null, true)
//Calculate the raw HMAC-MD5 hash of a given string value and key:
var hash = md5('value', 'key', true)