-
-
Save loskael/3e0026c790ee32415ca2ae9699e387b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1:解决中文不同的问题 | |
function md5(str) { | |
str = (new Buffer(str)).toString("binary"); | |
var ret = crypto.createHash("md5").update(str).digest("hex"); | |
return ret; | |
} | |
2:正常字符串加密 | |
function md5(str) { | |
var ret = crypto.createHash("md5").update(str.toString()).digest("hex"); | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment