在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:blueimp/JavaScript-MD5开源软件地址:https://github.com/blueimp/JavaScript-MD5开源编程语言:JavaScript 71.2%开源软件介绍:JavaScript MD5ContentsDescriptionJavaScript MD5 implementation. UsageClient-sideInstall the blueimp-md5 package with NPM: npm install blueimp-md5 Include the (minified) JavaScript MD5 script in your HTML markup: <script src="js/md5.min.js"></script> In your application code, calculate the (hex-encoded) MD5 hash of a string by calling the md5 method with the string as argument: var hash = md5('value') // "2063c1608d6e0baf80249c42e2be5804" Server-sideThe following is an example how to use the JavaScript MD5 module on the server-side with Node.js. Install the blueimp-md5 package with NPM: npm install blueimp-md5 Add a file server.js with the following content: require('http')
.createServer(function (req, res) {
// The md5 module exports the md5() function:
var md5 = require('./md5'),
// Use the following version if you installed the package with npm:
// var md5 = require("blueimp-md5"),
url = require('url'),
query = url.parse(req.url).query
res.writeHead(200, { 'Content-Type': 'text/plain' })
// Calculate and print the MD5 hash of the url query:
res.end(md5(query))
})
.listen(8080, 'localhost')
console.log('Server running at http://localhost:8080/') Run the application with the following command: node server.js RequirementsThe JavaScript MD5 script has zero dependencies. APICalculate 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) TestsThe JavaScript MD5 project comes with
Unit Tests.
The first one tests the browser integration, the second one the Node.js integration. LicenseThe JavaScript MD5 script is released under the MIT license. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论