|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<title>JSDoc: Home</title>
|
|
|
|
|
|
|
|
|
|
<script src="scripts/prettify/prettify.js"> </script>
|
|
|
|
|
<script src="scripts/prettify/lang-css.js"> </script>
|
|
|
|
|
<!--[if lt IE 9]>
|
|
|
|
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
|
|
|
<![endif]-->
|
|
|
|
|
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
|
|
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
|
<div id="main">
|
|
|
|
|
|
|
|
|
|
<h1 class="page-title">Home</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h3> </h3>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section>
|
|
|
|
|
<article><h1>js-md5</h1>
|
|
|
|
|
<p><a href="https://travis-ci.org/emn178/js-md5"><img src="https://travis-ci.org/emn178/js-md5.svg?branch=master" alt="Build Status"></a>
|
|
|
|
|
<a href="https://coveralls.io/r/emn178/js-md5?branch=master"><img src="https://coveralls.io/repos/emn178/js-md5/badge.svg?branch=master" alt="Coverage Status"></a><br>
|
|
|
|
|
<a href="https://nodei.co/npm/js-md5/"><img src="https://nodei.co/npm/js-md5.png?stars&downloads" alt="NPM"></a></p>
|
|
|
|
|
<p>A simple MD5 hash function for JavaScript supports UTF-8 encoding.</p>
|
|
|
|
|
<h2>Demo</h2>
|
|
|
|
|
<p><a href="http://emn178.github.io/online-tools/md5.html">MD5 Online</a><br>
|
|
|
|
|
<a href="http://emn178.github.io/online-tools/md5_checksum.html">MD5 File Checksum Online</a></p>
|
|
|
|
|
<h2>Download</h2>
|
|
|
|
|
<p><a href="https://raw.github.com/emn178/js-md5/master/build/md5.min.js">Compress</a><br>
|
|
|
|
|
<a href="https://raw.github.com/emn178/js-md5/master/src/md5.js">Uncompress</a></p>
|
|
|
|
|
<h2>Installation</h2>
|
|
|
|
|
<p>You can also install js-md5 by using Bower.</p>
|
|
|
|
|
<pre><code>bower install md5
|
|
|
|
|
</code></pre>
|
|
|
|
|
<p>For node.js, you can use this command to install:</p>
|
|
|
|
|
<pre><code>npm install js-md5
|
|
|
|
|
</code></pre>
|
|
|
|
|
<h2>Notice</h2>
|
|
|
|
|
<p><code>buffer</code> method is deprecated. This maybe confuse with Buffer in node.js. Please use <code>arrayBuffer</code> instead.</p>
|
|
|
|
|
<h2>Usage</h2>
|
|
|
|
|
<p>You could use like this:</p>
|
|
|
|
|
<pre class="prettyprint source lang-JavaScript"><code>md5('Message to hash');
|
|
|
|
|
var hash = md5.create();
|
|
|
|
|
hash.update('Message to hash');
|
|
|
|
|
hash.hex();
|
|
|
|
|
|
|
|
|
|
// HMAC
|
|
|
|
|
md5.hmac('key', 'Message to hash');
|
|
|
|
|
|
|
|
|
|
var hash = md5.hmac.create('key');
|
|
|
|
|
hash.update('Message to hash');
|
|
|
|
|
hash.hex();
|
|
|
|
|
</code></pre>
|
|
|
|
|
<h3>Node.js</h3>
|
|
|
|
|
<p>If you use node.js, you should require the module first:</p>
|
|
|
|
|
<pre class="prettyprint source lang-JavaScript"><code>var md5 = require('js-md5');
|
|
|
|
|
</code></pre>
|
|
|
|
|
<h2>RequireJS</h2>
|
|
|
|
|
<p>It supports AMD:</p>
|
|
|
|
|
<pre class="prettyprint source lang-JavaScript"><code>require(['your/path/md5.js'], function(md5) {
|
|
|
|
|
// ...
|
|
|
|
|
});
|
|
|
|
|
</code></pre>
|
|
|
|
|
<p><a href="https://emn178.github.com/js-md5/doc/">See document</a></p>
|
|
|
|
|
<h2>Example</h2>
|
|
|
|
|
<pre class="prettyprint source lang-JavaScript"><code>md5(''); // d41d8cd98f00b204e9800998ecf8427e
|
|
|
|
|
md5('The quick brown fox jumps over the lazy dog'); // 9e107d9d372bb6826bd81d3542a419d6
|
|
|
|
|
md5('The quick brown fox jumps over the lazy dog.'); // e4d909c290d0fb1ca068ffaddf22cbd0
|
|
|
|
|
|
|
|
|
|
// It also supports UTF-8 encoding
|
|
|
|
|
md5('中文'); // a7bac2239fcdcb3a067903d8077c4a07
|
|
|
|
|
|
|
|
|
|
// It also supports byte `Array`, `Uint8Array`, `ArrayBuffer`
|
|
|
|
|
md5([]); // d41d8cd98f00b204e9800998ecf8427e
|
|
|
|
|
md5(new Uint8Array([])); // d41d8cd98f00b204e9800998ecf8427e
|
|
|
|
|
|
|
|
|
|
// Different output
|
|
|
|
|
md5(''); // d41d8cd98f00b204e9800998ecf8427e
|
|
|
|
|
md5.hex(''); // d41d8cd98f00b204e9800998ecf8427e
|
|
|
|
|
md5.array(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]
|
|
|
|
|
md5.digest(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]
|
|
|
|
|
md5.arrayBuffer(''); // ArrayBuffer
|
|
|
|
|
md5.buffer(''); // ArrayBuffer, deprecated, This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
|
|
|
|
|
md5.base64(''); // 1B2M2Y8AsgTpgAmY7PhCfg==
|
|
|
|
|
|
|
|
|
|
// HMAC
|
|
|
|
|
md5.hmac.hex('key', 'Message to hash');
|
|
|
|
|
md5.hmac.array('key', 'Message to hash');
|
|
|
|
|
// ...
|
|
|
|
|
</code></pre>
|
|
|
|
|
<h2>License</h2>
|
|
|
|
|
<p>The project is released under the <a href="https://opensource.org/license/mit/">MIT license</a>.</p>
|
|
|
|
|
<h2>Contact</h2>
|
|
|
|
|
<p>The project's website is located at https://github.com/emn178/js-md5<br>
|
|
|
|
|
Author: Chen, Yi-Cyuan (emn178@gmail.com)</p></article>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<nav>
|
|
|
|
|
<h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="md5_.html">md5</a></li><li><a href="md5.hmac.html">hmac</a></li></ul><h3>Classes</h3><ul><li><a href="HmacMd5.html">HmacMd5</a></li><li><a href="Md5.html">Md5</a></li></ul><h3>Global</h3><ul><li><a href="global.html#md5%2508">md5</a></li></ul>
|
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
<br class="clear">
|
|
|
|
|
|
|
|
|
|
<footer>
|
|
|
|
|
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Sep 27 2023 21:32:04 GMT+0800 (台北標準時間)
|
|
|
|
|
</footer>
|
|
|
|
|
|
|
|
|
|
<script> prettyPrint(); </script>
|
|
|
|
|
<script src="scripts/linenumber.js"> </script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|