mirror of
https://github.com/emn178/js-md5.git
synced 2026-08-13 04:44:03 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b9a23ce32 | ||
|
|
da009f933f |
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
|
/node_modules/
|
||||||
/tests/
|
/tests/
|
||||||
node_modules/
|
|
||||||
|
|||||||
+2
-2
@@ -1,2 +1,2 @@
|
|||||||
covreporter
|
/node_modules/
|
||||||
node_modules
|
/covreporter/
|
||||||
|
|||||||
+3
-5
@@ -1,10 +1,8 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- "4.1"
|
- "0.12.15"
|
||||||
- "4.0"
|
- "4.5"
|
||||||
- "0.12"
|
- "6.5.0"
|
||||||
- "0.11"
|
|
||||||
- "0.10"
|
|
||||||
before_install:
|
before_install:
|
||||||
- npm install coveralls
|
- npm install coveralls
|
||||||
- npm install mocha-lcov-reporter
|
- npm install mocha-lcov-reporter
|
||||||
|
|||||||
+54
-42
@@ -1,54 +1,66 @@
|
|||||||
# v0.4.1 / 2016-03-31
|
# Change Log
|
||||||
|
|
||||||
* Removed length detection in node.js.
|
## v0.4.2 / 2017-01-18
|
||||||
* Deprecated `buffer` and replace by `arrayBuffer`.
|
### Fixed
|
||||||
|
- `root` is undefined in some special environment. #7
|
||||||
|
|
||||||
# v0.4.0 / 2015-12-28
|
## v0.4.1 / 2016-03-31
|
||||||
|
### Removed
|
||||||
|
- length detection in node.js.
|
||||||
|
### Deprecated
|
||||||
|
- `buffer` and replace by `arrayBuffer`.
|
||||||
|
|
||||||
* Added support for update hash.
|
## v0.4.0 / 2015-12-28
|
||||||
* Added support for bytes array output.
|
### Added
|
||||||
* Added support for ArrayBuffer output.
|
- support for update hash.
|
||||||
* Added support for AMD.
|
- support for bytes array output.
|
||||||
|
- support for ArrayBuffer output.
|
||||||
|
- support for AMD.
|
||||||
|
|
||||||
# v0.3.0 / 2015-03-07
|
## v0.3.0 / 2015-03-07
|
||||||
|
### Added
|
||||||
|
- support byte Array, Uint8Array and ArrayBuffer input.
|
||||||
|
|
||||||
* Support byte Array, Uint8Array and ArrayBuffer input.
|
## v0.2.2 / 2015-02-01
|
||||||
|
### Fixed
|
||||||
|
- bug when special length.
|
||||||
|
### Improve
|
||||||
|
- performance for node.js.
|
||||||
|
|
||||||
# v0.2.2 / 2015-02-01
|
## v0.2.1 / 2015-01-13
|
||||||
|
### Improve
|
||||||
|
- performance.
|
||||||
|
|
||||||
* Fixed bug when special length.
|
## v0.2.0 / 2015-01-12
|
||||||
* Improve performance for node.js.
|
### Removed
|
||||||
|
- ascii parameter.
|
||||||
|
### Improve
|
||||||
|
- performance.
|
||||||
|
|
||||||
# v0.2.1 / 2015-01-13
|
## v0.1.4 / 2015-01-11
|
||||||
|
### Improve
|
||||||
|
- performance.
|
||||||
|
### Added
|
||||||
|
- test cases.
|
||||||
|
|
||||||
* Improve performance.
|
## v0.1.3 / 2015-01-05
|
||||||
|
### Added
|
||||||
|
- bower package.
|
||||||
|
- travis.
|
||||||
|
- coveralls.
|
||||||
|
### Improved
|
||||||
|
- performance.
|
||||||
|
### Fixed
|
||||||
|
- JSHint warnings.
|
||||||
|
|
||||||
# v0.2.0 / 2015-01-12
|
## v0.1.2 / 2014-07-27
|
||||||
|
### Fixed
|
||||||
|
- accents bug
|
||||||
|
|
||||||
* Remove ascii parameter.
|
## v0.1.1 / 2014-01-05
|
||||||
* Improve performance.
|
### Changed
|
||||||
|
- license
|
||||||
|
|
||||||
# v0.1.4 / 2015-01-11
|
## v0.1.0 / 2014-01-04
|
||||||
|
### Added
|
||||||
* Improve performance.
|
- initial release
|
||||||
* Add test case.
|
|
||||||
|
|
||||||
# v0.1.3 / 2015-01-05
|
|
||||||
|
|
||||||
* Improve performance.
|
|
||||||
* Add bower package.
|
|
||||||
* Fixed JSHint warnings.
|
|
||||||
* Add travis.
|
|
||||||
* Add coveralls.
|
|
||||||
|
|
||||||
# v0.1.2 / 2014-07-27
|
|
||||||
|
|
||||||
Fixed accents bug
|
|
||||||
|
|
||||||
# v0.1.1 / 2014-01-05
|
|
||||||
|
|
||||||
Update license
|
|
||||||
|
|
||||||
# v0.1.0 / 2014-01-04
|
|
||||||
|
|
||||||
Initial release
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
Copyright 2014-2016 Chen, Yi-Cyuan
|
Copyright 2014-2017 Chen, Yi-Cyuan
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
a copy of this software and associated documentation files (the
|
a copy of this software and associated documentation files (the
|
||||||
|
|||||||
@@ -67,10 +67,6 @@ md5.arrayBuffer(''); // ArrayBuffer
|
|||||||
md5.buffer(''); // ArrayBuffer, deprecated, This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
|
md5.buffer(''); // ArrayBuffer, deprecated, This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
|
||||||
```
|
```
|
||||||
|
|
||||||
## Benchmark
|
|
||||||
[UTF8](http://jsperf.com/md5-shootout/81)
|
|
||||||
[ASCII](http://jsperf.com/md5-shootout/82)
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
The project is released under the [MIT license](http://www.opensource.org/licenses/MIT).
|
The project is released under the [MIT license](http://www.opensource.org/licenses/MIT).
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "js-md5",
|
"name": "js-md5",
|
||||||
"version": "0.4.1",
|
"version": "0.4.2",
|
||||||
"main": ["src/md5.js"],
|
"main": ["src/md5.js"],
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"tests"
|
"tests"
|
||||||
|
|||||||
Vendored
+3
-3
File diff suppressed because one or more lines are too long
+9
-9
@@ -91,7 +91,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line149">line 149</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line141">line 141</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line531">line 531</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line523">line 523</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -314,7 +314,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line543">line 543</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line535">line 535</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -432,7 +432,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line565">line 565</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line557">line 557</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -548,7 +548,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line509">line 509</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line501">line 501</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -664,7 +664,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line464">line 464</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line456">line 456</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -780,7 +780,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line497">line 497</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line489">line 489</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -954,7 +954,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line177">line 177</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line169">line 169</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -1031,7 +1031,7 @@
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Mar 31 2016 16:24:21 GMT+0800 (CST)
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Wed Jan 18 2017 09:43:27 GMT+0800 (CST)
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script> prettyPrint(); </script>
|
<script> prettyPrint(); </script>
|
||||||
|
|||||||
+2
-2
@@ -210,7 +210,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line583">line 583</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line575">line 575</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Md5_.html">Md5</a></li></ul><h3>Namespaces</h3><ul><li><a href="md5.html">md5</a></li></ul><h3>Global</h3><ul><li><a href="global.html#md5%2508">md5</a></li></ul>
|
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Md5_.html">Md5</a></li></ul><h3>Namespaces</h3><ul><li><a href="md5.html">md5</a></li></ul><h3>Global</h3><ul><li><a href="global.html#md5%2508">md5</a></li></ul>
|
||||||
|
|||||||
+2
-3
@@ -77,8 +77,7 @@ md5.hex(''); // d41d8cd98f00b204e9800998ecf8427e
|
|||||||
md5.array(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]
|
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.digest(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]
|
||||||
md5.arrayBuffer(''); // ArrayBuffer
|
md5.arrayBuffer(''); // ArrayBuffer
|
||||||
md5.buffer(''); // ArrayBuffer, deprecated, This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.</code></pre><h2>Benchmark</h2><p><a href="http://jsperf.com/md5-shootout/81">UTF8</a><br><a href="http://jsperf.com/md5-shootout/82">ASCII</a></p>
|
md5.buffer(''); // ArrayBuffer, deprecated, This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.</code></pre><h2>License</h2><p>The project is released under the <a href="http://www.opensource.org/licenses/MIT">MIT license</a>.</p>
|
||||||
<h2>License</h2><p>The project is released under the <a href="http://www.opensource.org/licenses/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>
|
<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>
|
</section>
|
||||||
|
|
||||||
@@ -96,7 +95,7 @@ md5.buffer(''); // ArrayBuffer, deprecated, This maybe confuse with Buffer in no
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Mar 31 2016 16:24:21 GMT+0800 (CST)
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Wed Jan 18 2017 09:43:27 GMT+0800 (CST)
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script> prettyPrint(); </script>
|
<script> prettyPrint(); </script>
|
||||||
|
|||||||
+10
-10
@@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<dt class="tag-version">Version:</dt>
|
<dt class="tag-version">Version:</dt>
|
||||||
<dd class="tag-version"><ul class="dummy"><li>0.4.0</li></ul></dd>
|
<dd class="tag-version"><ul class="dummy"><li>0.4.2</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<dt class="tag-copyright">Copyright:</dt>
|
<dt class="tag-copyright">Copyright:</dt>
|
||||||
<dd class="tag-copyright"><ul class="dummy"><li>Chen, Yi-Cyuan 2014-2016</li></ul></dd>
|
<dd class="tag-copyright"><ul class="dummy"><li>Chen, Yi-Cyuan 2014-2017</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line52">line 52</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line53">line 53</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -400,7 +400,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line61">line 61</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line62">line 62</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -569,7 +569,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line70">line 70</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line71">line 71</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -678,7 +678,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line86">line 86</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line87">line 87</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -845,7 +845,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line43">line 43</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line44">line 44</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -1012,7 +1012,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line32">line 32</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line33">line 33</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -1179,7 +1179,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line95">line 95</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line95">line 95</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
@@ -1254,7 +1254,7 @@
|
|||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Md5_.html">Md5</a></li></ul><h3>Namespaces</h3><ul><li><a href="md5.html">md5</a></li></ul><h3>Global</h3><ul><li><a href="global.html#md5%2508">md5</a></li></ul>
|
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Md5_.html">Md5</a></li></ul><h3>Namespaces</h3><ul><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>
|
</nav>
|
||||||
|
|
||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
|
|||||||
+19
-27
@@ -30,21 +30,22 @@
|
|||||||
* [js-md5]{@link https://github.com/emn178/js-md5}
|
* [js-md5]{@link https://github.com/emn178/js-md5}
|
||||||
*
|
*
|
||||||
* @namespace md5
|
* @namespace md5
|
||||||
* @version 0.4.0
|
* @version 0.4.2
|
||||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||||
* @copyright Chen, Yi-Cyuan 2014-2016
|
* @copyright Chen, Yi-Cyuan 2014-2017
|
||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
(function (root) {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var NODE_JS = typeof process == 'object' && process.versions && process.versions.node;
|
var root = typeof window === 'object' ? window : {};
|
||||||
|
var NODE_JS = !root.JS_MD5_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
|
||||||
if (NODE_JS) {
|
if (NODE_JS) {
|
||||||
root = global;
|
root = global;
|
||||||
}
|
}
|
||||||
var COMMON_JS = !root.JS_MD5_TEST && typeof module == 'object' && module.exports;
|
var COMMON_JS = !root.JS_MD5_NO_COMMON_JS && typeof module === 'object' && module.exports;
|
||||||
var AMD = typeof define == 'function' && define.amd;
|
var AMD = typeof define === 'function' && define.amd;
|
||||||
var ARRAY_BUFFER = !root.JS_MD5_TEST && typeof ArrayBuffer != 'undefined';
|
var ARRAY_BUFFER = !root.JS_MD5_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
|
||||||
var HEX_CHARS = '0123456789abcdef'.split('');
|
var HEX_CHARS = '0123456789abcdef'.split('');
|
||||||
var EXTRA = [128, 32768, 8388608, -2147483648];
|
var EXTRA = [128, 32768, 8388608, -2147483648];
|
||||||
var SHIFT = [0, 8, 16, 24];
|
var SHIFT = [0, 8, 16, 24];
|
||||||
@@ -142,7 +143,7 @@
|
|||||||
method.update = function (message) {
|
method.update = function (message) {
|
||||||
return method.create().update(message);
|
return method.create().update(message);
|
||||||
};
|
};
|
||||||
for (var i = 0;i < OUTPUT_TYPES.length;++i) {
|
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
|
||||||
var type = OUTPUT_TYPES[i];
|
var type = OUTPUT_TYPES[i];
|
||||||
method[type] = createOutputMethod(type);
|
method[type] = createOutputMethod(type);
|
||||||
}
|
}
|
||||||
@@ -150,21 +151,12 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var nodeWrap = function (method) {
|
var nodeWrap = function (method) {
|
||||||
var crypto, Buffer;
|
var crypto = require('crypto');
|
||||||
try {
|
var Buffer = require('buffer').Buffer;
|
||||||
if (root.JS_MD5_TEST) {
|
|
||||||
throw 'JS_MD5_TEST';
|
|
||||||
}
|
|
||||||
crypto = require('crypto');
|
|
||||||
Buffer = require('buffer').Buffer;
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
var nodeMethod = function (message) {
|
var nodeMethod = function (message) {
|
||||||
if (typeof message == 'string') {
|
if (typeof message === 'string') {
|
||||||
return crypto.createHash('md5').update(message, 'utf8').digest('hex');
|
return crypto.createHash('md5').update(message, 'utf8').digest('hex');
|
||||||
} else if (message.constructor == ArrayBuffer) {
|
} else if (message.constructor === ArrayBuffer) {
|
||||||
message = new Uint8Array(message);
|
message = new Uint8Array(message);
|
||||||
} else if (message.length === undefined) {
|
} else if (message.length === undefined) {
|
||||||
return method(message);
|
return method(message);
|
||||||
@@ -234,17 +226,17 @@
|
|||||||
|
|
||||||
if (notString) {
|
if (notString) {
|
||||||
if (ARRAY_BUFFER) {
|
if (ARRAY_BUFFER) {
|
||||||
for (i = this.start;index < length && i < 64; ++index) {
|
for (i = this.start; index < length && i < 64; ++index) {
|
||||||
buffer8[i++] = message[index];
|
buffer8[i++] = message[index];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = this.start;index < length && i < 64; ++index) {
|
for (i = this.start; index < length && i < 64; ++index) {
|
||||||
blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
|
blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ARRAY_BUFFER) {
|
if (ARRAY_BUFFER) {
|
||||||
for (i = this.start;index < length && i < 64; ++index) {
|
for (i = this.start; index < length && i < 64; ++index) {
|
||||||
code = message.charCodeAt(index);
|
code = message.charCodeAt(index);
|
||||||
if (code < 0x80) {
|
if (code < 0x80) {
|
||||||
buffer8[i++] = code;
|
buffer8[i++] = code;
|
||||||
@@ -264,7 +256,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = this.start;index < length && i < 64; ++index) {
|
for (i = this.start; index < length && i < 64; ++index) {
|
||||||
code = message.charCodeAt(index);
|
code = message.charCodeAt(index);
|
||||||
if (code < 0x80) {
|
if (code < 0x80) {
|
||||||
blocks[i >> 2] |= code << SHIFT[i++ & 3];
|
blocks[i >> 2] |= code << SHIFT[i++ & 3];
|
||||||
@@ -632,7 +624,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}(this));
|
})();
|
||||||
</code></pre>
|
</code></pre>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
@@ -649,7 +641,7 @@
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Mar 31 2016 16:24:20 GMT+0800 (CST)
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Wed Jan 18 2017 09:43:27 GMT+0800 (CST)
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script> prettyPrint(); </script>
|
<script> prettyPrint(); </script>
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ h1
|
|||||||
margin: 12px 24px 20px;
|
margin: 12px 24px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2, h3
|
h2, h3.subsection-title
|
||||||
{
|
{
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
@@ -161,6 +161,13 @@ h2, h3
|
|||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h3
|
||||||
|
{
|
||||||
|
font-size: 24px;
|
||||||
|
letter-spacing: -0.5px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
h4
|
h4
|
||||||
{
|
{
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
@@ -185,6 +192,32 @@ h6
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table
|
||||||
|
{
|
||||||
|
border-spacing: 0;
|
||||||
|
border: 0;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
td, th
|
||||||
|
{
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
margin: 0px;
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px 6px;
|
||||||
|
display: table-cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
thead tr
|
||||||
|
{
|
||||||
|
background-color: #ddd;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
th { border-right: 1px solid #aaa; }
|
||||||
|
tr > th:last-child { border-right: 1px solid #ddd; }
|
||||||
|
|
||||||
.ancestors { color: #999; }
|
.ancestors { color: #999; }
|
||||||
.ancestors a
|
.ancestors a
|
||||||
{
|
{
|
||||||
@@ -296,44 +329,12 @@ h6
|
|||||||
user-select: text;
|
user-select: text;
|
||||||
}
|
}
|
||||||
|
|
||||||
.params, .props
|
|
||||||
{
|
|
||||||
border-spacing: 0;
|
|
||||||
border: 0;
|
|
||||||
border-collapse: collapse;
|
|
||||||
}
|
|
||||||
|
|
||||||
.params .name, .props .name, .name code {
|
.params .name, .props .name, .name code {
|
||||||
color: #4D4E53;
|
color: #4D4E53;
|
||||||
font-family: Consolas, Monaco, 'Andale Mono', monospace;
|
font-family: Consolas, Monaco, 'Andale Mono', monospace;
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.params td, .params th, .props td, .props th
|
|
||||||
{
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
margin: 0px;
|
|
||||||
text-align: left;
|
|
||||||
vertical-align: top;
|
|
||||||
padding: 4px 6px;
|
|
||||||
display: table-cell;
|
|
||||||
}
|
|
||||||
|
|
||||||
.params thead tr, .props thead tr
|
|
||||||
{
|
|
||||||
background-color: #ddd;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.params .params thead tr, .props .props thead tr
|
|
||||||
{
|
|
||||||
background-color: #fff;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.params th, .props th { border-right: 1px solid #aaa; }
|
|
||||||
.params thead .last, .props thead .last { border-right: 1px solid #ddd; }
|
|
||||||
|
|
||||||
.params td.description > p:first-child,
|
.params td.description > p:first-child,
|
||||||
.props td.description > p:first-child
|
.props td.description > p:first-child
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "js-md5",
|
"name": "js-md5",
|
||||||
"version": "0.4.1",
|
"version": "0.4.2",
|
||||||
"description": "A simple MD5 hash function for JavaScript supports UTF-8 encoding.",
|
"description": "A simple MD5 hash function for JavaScript supports UTF-8 encoding.",
|
||||||
"main": "src/md5.js",
|
"main": "src/md5.js",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
+18
-26
@@ -2,21 +2,22 @@
|
|||||||
* [js-md5]{@link https://github.com/emn178/js-md5}
|
* [js-md5]{@link https://github.com/emn178/js-md5}
|
||||||
*
|
*
|
||||||
* @namespace md5
|
* @namespace md5
|
||||||
* @version 0.4.0
|
* @version 0.4.2
|
||||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||||
* @copyright Chen, Yi-Cyuan 2014-2016
|
* @copyright Chen, Yi-Cyuan 2014-2017
|
||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
(function (root) {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var NODE_JS = typeof process == 'object' && process.versions && process.versions.node;
|
var root = typeof window === 'object' ? window : {};
|
||||||
|
var NODE_JS = !root.JS_MD5_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
|
||||||
if (NODE_JS) {
|
if (NODE_JS) {
|
||||||
root = global;
|
root = global;
|
||||||
}
|
}
|
||||||
var COMMON_JS = !root.JS_MD5_TEST && typeof module == 'object' && module.exports;
|
var COMMON_JS = !root.JS_MD5_NO_COMMON_JS && typeof module === 'object' && module.exports;
|
||||||
var AMD = typeof define == 'function' && define.amd;
|
var AMD = typeof define === 'function' && define.amd;
|
||||||
var ARRAY_BUFFER = !root.JS_MD5_TEST && typeof ArrayBuffer != 'undefined';
|
var ARRAY_BUFFER = !root.JS_MD5_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
|
||||||
var HEX_CHARS = '0123456789abcdef'.split('');
|
var HEX_CHARS = '0123456789abcdef'.split('');
|
||||||
var EXTRA = [128, 32768, 8388608, -2147483648];
|
var EXTRA = [128, 32768, 8388608, -2147483648];
|
||||||
var SHIFT = [0, 8, 16, 24];
|
var SHIFT = [0, 8, 16, 24];
|
||||||
@@ -114,7 +115,7 @@
|
|||||||
method.update = function (message) {
|
method.update = function (message) {
|
||||||
return method.create().update(message);
|
return method.create().update(message);
|
||||||
};
|
};
|
||||||
for (var i = 0;i < OUTPUT_TYPES.length;++i) {
|
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
|
||||||
var type = OUTPUT_TYPES[i];
|
var type = OUTPUT_TYPES[i];
|
||||||
method[type] = createOutputMethod(type);
|
method[type] = createOutputMethod(type);
|
||||||
}
|
}
|
||||||
@@ -122,21 +123,12 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var nodeWrap = function (method) {
|
var nodeWrap = function (method) {
|
||||||
var crypto, Buffer;
|
var crypto = require('crypto');
|
||||||
try {
|
var Buffer = require('buffer').Buffer;
|
||||||
if (root.JS_MD5_TEST) {
|
|
||||||
throw 'JS_MD5_TEST';
|
|
||||||
}
|
|
||||||
crypto = require('crypto');
|
|
||||||
Buffer = require('buffer').Buffer;
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
var nodeMethod = function (message) {
|
var nodeMethod = function (message) {
|
||||||
if (typeof message == 'string') {
|
if (typeof message === 'string') {
|
||||||
return crypto.createHash('md5').update(message, 'utf8').digest('hex');
|
return crypto.createHash('md5').update(message, 'utf8').digest('hex');
|
||||||
} else if (message.constructor == ArrayBuffer) {
|
} else if (message.constructor === ArrayBuffer) {
|
||||||
message = new Uint8Array(message);
|
message = new Uint8Array(message);
|
||||||
} else if (message.length === undefined) {
|
} else if (message.length === undefined) {
|
||||||
return method(message);
|
return method(message);
|
||||||
@@ -206,17 +198,17 @@
|
|||||||
|
|
||||||
if (notString) {
|
if (notString) {
|
||||||
if (ARRAY_BUFFER) {
|
if (ARRAY_BUFFER) {
|
||||||
for (i = this.start;index < length && i < 64; ++index) {
|
for (i = this.start; index < length && i < 64; ++index) {
|
||||||
buffer8[i++] = message[index];
|
buffer8[i++] = message[index];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = this.start;index < length && i < 64; ++index) {
|
for (i = this.start; index < length && i < 64; ++index) {
|
||||||
blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
|
blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ARRAY_BUFFER) {
|
if (ARRAY_BUFFER) {
|
||||||
for (i = this.start;index < length && i < 64; ++index) {
|
for (i = this.start; index < length && i < 64; ++index) {
|
||||||
code = message.charCodeAt(index);
|
code = message.charCodeAt(index);
|
||||||
if (code < 0x80) {
|
if (code < 0x80) {
|
||||||
buffer8[i++] = code;
|
buffer8[i++] = code;
|
||||||
@@ -236,7 +228,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = this.start;index < length && i < 64; ++index) {
|
for (i = this.start; index < length && i < 64; ++index) {
|
||||||
code = message.charCodeAt(index);
|
code = message.charCodeAt(index);
|
||||||
if (code < 0x80) {
|
if (code < 0x80) {
|
||||||
blocks[i >> 2] |= code << SHIFT[i++ & 3];
|
blocks[i >> 2] |= code << SHIFT[i++ & 3];
|
||||||
@@ -604,4 +596,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}(this));
|
})();
|
||||||
|
|||||||
+33
-2
@@ -1,12 +1,26 @@
|
|||||||
md5 = require('../src/md5.js');
|
// Node.js env
|
||||||
expect = require('expect.js');
|
expect = require('expect.js');
|
||||||
|
md5 = require('../src/md5.js');
|
||||||
require('./test.js');
|
require('./test.js');
|
||||||
|
|
||||||
delete require.cache[require.resolve('../src/md5.js')]
|
delete require.cache[require.resolve('../src/md5.js')]
|
||||||
delete require.cache[require.resolve('./test.js')]
|
delete require.cache[require.resolve('./test.js')]
|
||||||
md5 = null
|
md5 = null
|
||||||
|
|
||||||
JS_MD5_TEST = true;
|
// Webpack browser env
|
||||||
|
JS_MD5_NO_NODE_JS = true;
|
||||||
|
window = global;
|
||||||
|
md5 = require('../src/md5.js');
|
||||||
|
require('./test.js');
|
||||||
|
|
||||||
|
delete require.cache[require.resolve('../src/md5.js')];
|
||||||
|
delete require.cache[require.resolve('./test.js')];
|
||||||
|
md5 = null;
|
||||||
|
|
||||||
|
// browser env
|
||||||
|
JS_MD5_NO_NODE_JS = true;
|
||||||
|
JS_MD5_NO_COMMON_JS = true;
|
||||||
|
window = global;
|
||||||
require('../src/md5.js');
|
require('../src/md5.js');
|
||||||
require('./test.js');
|
require('./test.js');
|
||||||
|
|
||||||
@@ -14,6 +28,23 @@ delete require.cache[require.resolve('../src/md5.js')];
|
|||||||
delete require.cache[require.resolve('./test.js')];
|
delete require.cache[require.resolve('./test.js')];
|
||||||
md5 = null;
|
md5 = null;
|
||||||
|
|
||||||
|
// browser env and no array buffer
|
||||||
|
JS_MD5_NO_NODE_JS = true;
|
||||||
|
JS_MD5_NO_COMMON_JS = true;
|
||||||
|
JS_MD5_NO_ARRAY_BUFFER = true;
|
||||||
|
window = global;
|
||||||
|
require('../src/md5.js');
|
||||||
|
require('./test.js');
|
||||||
|
|
||||||
|
delete require.cache[require.resolve('../src/md5.js')];
|
||||||
|
delete require.cache[require.resolve('./test.js')];
|
||||||
|
md5 = null;
|
||||||
|
|
||||||
|
// browser AMD
|
||||||
|
JS_MD5_NO_NODE_JS = true;
|
||||||
|
JS_MD5_NO_COMMON_JS = true;
|
||||||
|
JS_MD5_NO_ARRAY_BUFFER = false;
|
||||||
|
window = global;
|
||||||
define = function (func) {
|
define = function (func) {
|
||||||
md5 = func();
|
md5 = func();
|
||||||
require('./test.js');
|
require('./test.js');
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
Array.prototype.toHexString = ArrayBuffer.prototype.toHexString = function () {
|
Array.prototype.toHexString = ArrayBuffer.prototype.toHexString = function () {
|
||||||
var array = new Uint8Array(this);
|
var array = new Uint8Array(this);
|
||||||
var hex = '';
|
var hex = '';
|
||||||
for (var i = 0;i < array.length;++i) {
|
for (var i = 0; i < array.length; ++i) {
|
||||||
var c = array[i].toString('16');
|
var c = array[i].toString('16');
|
||||||
hex += c.length == 1 ? '0' + c : c;
|
hex += c.length == 1 ? '0' + c : c;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user