{"_id":"spark-md5","_rev":"637252","name":"spark-md5","description":"Lightning fast normal and incremental md5 for javascript","dist-tags":{"latest":"3.0.2"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"time":{"modified":"2021-08-25T16:05:48.000Z","created":"2013-11-07T21:28:15.139Z","3.0.2":"2021-08-25T16:04:19.949Z","3.0.1":"2020-03-09T14:08:12.223Z","3.0.0":"2016-11-30T22:30:34.457Z","2.0.2":"2016-02-22T09:42:00.664Z","2.0.1":"2016-02-21T23:17:15.421Z","1.0.1":"2016-02-21T23:16:07.469Z","2.0.0":"2015-11-02T14:39:07.863Z","1.0.0":"2015-07-07T18:39:52.902Z","0.0.5":"2013-11-07T21:28:15.139Z"},"users":{"csbun":true,"satazor":true,"tyouritugenn":true,"steve3d3d":true,"steel1990":true,"albsugy":true,"muzi131313":true,"mahy50":true,"yanghcc":true},"author":{"name":"André Cruz","email":"andremiguelcruz@msn.com"},"repository":{"type":"git","url":"git+ssh://git@github.com/satazor/js-spark-md5.git"},"versions":{"3.0.2":{"name":"spark-md5","version":"3.0.2","description":"Lightning fast normal and incremental md5 for javascript","main":"spark-md5.js","directories":{"test":"test"},"repository":{"type":"git","url":"git+ssh://git@github.com/satazor/js-spark-md5.git"},"keywords":["md5","fast","spark","incremental"],"author":{"name":"André Cruz","email":"andremiguelcruz@msn.com"},"license":"(WTFPL OR MIT)","bugs":{"url":"https://github.com/satazor/js-spark-md5/issues"},"scripts":{"min":"uglifyjs spark-md5.js > spark-md5.min.js","test":"open test/index.html"},"devDependencies":{"uglify-js":"^3.0.0"},"gitHead":"9315385868fe11076674d4ddd763005319a462a7","homepage":"https://github.com/satazor/js-spark-md5#readme","_id":"spark-md5@3.0.2","_nodeVersion":"16.1.0","_npmVersion":"7.19.1","dist":{"shasum":"7952c4a30784347abcee73268e473b9c0167e3fc","size":9726,"noattachment":false,"key":"/spark-md5/-/spark-md5-3.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/spark-md5/download/spark-md5-3.0.2.tgz"},"_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/spark-md5_3.0.2_1629907459747_0.6319678372181592"},"_hasShrinkwrap":false,"publish_time":1629907459949,"_cnpm_publish_time":1629907459949},"3.0.1":{"name":"spark-md5","version":"3.0.1","description":"Lightning fast normal and incremental md5 for javascript","main":"spark-md5.js","directories":{"test":"test"},"repository":{"type":"git","url":"git+ssh://git@github.com/satazor/js-spark-md5.git"},"keywords":["md5","fast","spark","incremental"],"author":{"name":"André Cruz","email":"andremiguelcruz@msn.com"},"license":"WTFPL","bugs":{"url":"https://github.com/satazor/js-spark-md5/issues"},"scripts":{"min":"uglifyjs spark-md5.js > spark-md5.min.js","test":"open test/index.html"},"devDependencies":{"uglify-js":"^3.0.0"},"gitHead":"c3d964c605befba62d608d2c0fe3dfbf06e251fb","homepage":"https://github.com/satazor/js-spark-md5#readme","_id":"spark-md5@3.0.1","_nodeVersion":"12.13.1","_npmVersion":"6.12.1","dist":{"shasum":"83a0e255734f2ab4e5c466e5a2cfc9ba2aa2124d","size":9795,"noattachment":false,"key":"/spark-md5/-/spark-md5-3.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/spark-md5/download/spark-md5-3.0.1.tgz"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/spark-md5_3.0.1_1583762892058_0.46574592096544043"},"_hasShrinkwrap":false,"publish_time":1583762892223,"_cnpm_publish_time":1583762892223},"3.0.0":{"name":"spark-md5","version":"3.0.0","description":"Lightning fast normal and incremental md5 for javascript","main":"spark-md5.js","files":["spark-md5.js","spark-md5.min.js"],"directories":{"test":"test"},"repository":{"type":"git","url":"git+ssh://git@github.com/satazor/js-spark-md5.git"},"keywords":["md5","fast","spark","incremental"],"author":{"name":"André Cruz","email":"andremiguelcruz@msn.com"},"license":"WTFPL","bugs":{"url":"https://github.com/satazor/js-spark-md5/issues"},"scripts":{"min":"uglifyjs spark-md5.js > spark-md5.min.js","test":"open test/index.html"},"devDependencies":{"uglify-js":"^2.4.16"},"gitHead":"903405770868037cfdc73e33370464b11b741943","homepage":"https://github.com/satazor/js-spark-md5#readme","_id":"spark-md5@3.0.0","_shasum":"3722227c54e2faf24b1dc6d933cc144e6f71bfef","_from":".","_npmVersion":"3.10.8","_nodeVersion":"7.0.0","_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"dist":{"shasum":"3722227c54e2faf24b1dc6d933cc144e6f71bfef","size":9662,"noattachment":false,"key":"/spark-md5/-/spark-md5-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/spark-md5/download/spark-md5-3.0.0.tgz"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/spark-md5-3.0.0.tgz_1480545033790_0.31334604136645794"},"publish_time":1480545034457,"_cnpm_publish_time":1480545034457,"_hasShrinkwrap":false},"2.0.2":{"name":"spark-md5","version":"2.0.2","description":"Lightning fast normal and incremental md5 for javascript","main":"spark-md5.js","files":["spark-md5.js","spark-md5.min.js"],"directories":{"test":"test"},"repository":{"type":"git","url":"git@github.com:satazor/js-spark-md5.git"},"keywords":["md5","fast","spark","incremental"],"author":{"name":"André Cruz","email":"andremiguelcruz@msn.com"},"license":"WTFPL","bugs":{"url":"https://github.com/satazor/js-spark-md5/issues"},"scripts":{"min":"uglifyjs spark-md5.js > spark-md5.min.js","test":"open test/index.html"},"devDependencies":{"uglify-js":"^2.4.16"},"gitHead":"3f6d6d2a3ffee05f7175a42794392eb52fd694c0","homepage":"https://github.com/satazor/js-spark-md5","_id":"spark-md5@2.0.2","_shasum":"37b763847763ae7e7acef2ca5233d01e649a78b7","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.6","_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"dist":{"shasum":"37b763847763ae7e7acef2ca5233d01e649a78b7","size":9480,"noattachment":false,"key":"/spark-md5/-/spark-md5-2.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/spark-md5/download/spark-md5-2.0.2.tgz"},"_npmOperationalInternal":{"host":"packages-5-east.internal.npmjs.com","tmp":"tmp/spark-md5-2.0.2.tgz_1456134117502_0.3172476140316576"},"publish_time":1456134120664,"_cnpm_publish_time":1456134120664,"_hasShrinkwrap":false},"2.0.1":{"name":"spark-md5","version":"2.0.1","description":"Lightning fast normal and incremental md5 for javascript","main":"spark-md5.js","directories":{"test":"test"},"repository":{"type":"git","url":"git@github.com:satazor/js-spark-md5.git"},"keywords":["md5","fast","spark","incremental"],"author":{"name":"André Cruz","email":"andremiguelcruz@msn.com"},"license":"WTFPL","bugs":{"url":"https://github.com/satazor/js-spark-md5/issues"},"scripts":{"min":"uglifyjs spark-md5.js > spark-md5.min.js","test":"open test/index.html"},"devDependencies":{"uglify-js":"^2.4.16"},"gitHead":"7f3a88c6601601c23c4d12f4432e87f949ebb256","homepage":"https://github.com/satazor/js-spark-md5","_id":"spark-md5@2.0.1","_shasum":"11bb373de5abf77cf3ed96aabb7a575d780b3678","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.6","_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"dist":{"shasum":"11bb373de5abf77cf3ed96aabb7a575d780b3678","size":47127,"noattachment":false,"key":"/spark-md5/-/spark-md5-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/spark-md5/download/spark-md5-2.0.1.tgz"},"_npmOperationalInternal":{"host":"packages-5-east.internal.npmjs.com","tmp":"tmp/spark-md5-2.0.1.tgz_1456096631882_0.007282960461452603"},"publish_time":1456096635421,"_cnpm_publish_time":1456096635421,"_hasShrinkwrap":false},"1.0.1":{"name":"spark-md5","version":"1.0.1","description":"Lightning fast normal and incremental md5 for javascript","main":"spark-md5.js","directories":{"test":"test"},"repository":{"type":"git","url":"git@github.com:satazor/SparkMD5.git"},"keywords":["md5","fast","spark","incremental"],"author":{"name":"André Cruz","email":"andremiguelcruz@msn.com"},"license":"WTFPL","bugs":{"url":"https://github.com/satazor/SparkMD5/issues"},"scripts":{"min":"uglifyjs spark-md5.js > spark-md5.min.js","test":"open test/index.html"},"devDependencies":{"uglify-js":"^2.4.16"},"gitHead":"32e9e52292e0a38c2d22916db49c85d7f16b7d1d","homepage":"https://github.com/satazor/SparkMD5","_id":"spark-md5@1.0.1","_shasum":"c4b9a8d41cf7b0845423a821824f8dffa0f51b7c","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.6","_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"dist":{"shasum":"c4b9a8d41cf7b0845423a821824f8dffa0f51b7c","size":46079,"noattachment":false,"key":"/spark-md5/-/spark-md5-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/spark-md5/download/spark-md5-1.0.1.tgz"},"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/spark-md5-1.0.1.tgz_1456096562618_0.16418782901018858"},"publish_time":1456096567469,"_cnpm_publish_time":1456096567469,"_hasShrinkwrap":false},"2.0.0":{"name":"spark-md5","version":"2.0.0","description":"Lightning fast normal and incremental md5 for javascript","main":"spark-md5.js","directories":{"test":"test"},"repository":{"type":"git","url":"git+ssh://git@github.com/satazor/SparkMD5.git"},"keywords":["md5","fast","spark","incremental"],"author":{"name":"André Cruz","email":"andremiguelcruz@msn.com"},"license":"WTFPL","bugs":{"url":"https://github.com/satazor/SparkMD5/issues"},"scripts":{"min":"uglifyjs spark-md5.js > spark-md5.min.js","test":"open test/index.html"},"devDependencies":{"uglify-js":"^2.4.16"},"gitHead":"018fee878fde6dc0a064e057b3c95cd5b017e788","homepage":"https://github.com/satazor/SparkMD5#readme","_id":"spark-md5@2.0.0","_shasum":"3b1bf1824cecdc2c171ada15780abd269a292711","_from":".","_npmVersion":"2.13.1","_nodeVersion":"0.12.7","_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"dist":{"shasum":"3b1bf1824cecdc2c171ada15780abd269a292711","size":46360,"noattachment":false,"key":"/spark-md5/-/spark-md5-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/spark-md5/download/spark-md5-2.0.0.tgz"},"publish_time":1446475147863,"_cnpm_publish_time":1446475147863,"_hasShrinkwrap":false},"1.0.0":{"name":"spark-md5","version":"1.0.0","description":"Lightning fast normal and incremental md5 for javascript","main":"spark-md5.js","directories":{"test":"test"},"repository":{"type":"git","url":"git+ssh://git@github.com/satazor/SparkMD5.git"},"keywords":["md5","fast","spark","incremental"],"author":{"name":"André Cruz","email":"andremiguelcruz@msn.com"},"license":"WTFPL","bugs":{"url":"https://github.com/satazor/SparkMD5/issues"},"scripts":{"min":"uglifyjs spark-md5.js > spark-md5.min.js","test":"open test/index.html"},"devDependencies":{"uglify-js":"^2.4.16"},"gitHead":"00c5a9883c0d6cf71e5db706a840a76080847e7b","homepage":"https://github.com/satazor/SparkMD5#readme","_id":"spark-md5@1.0.0","_shasum":"c1c2c78fb09c2f0d86a864a9339fc92e2f194690","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"dist":{"shasum":"c1c2c78fb09c2f0d86a864a9339fc92e2f194690","size":45564,"noattachment":false,"key":"/spark-md5/-/spark-md5-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/spark-md5/download/spark-md5-1.0.0.tgz"},"publish_time":1436294392902,"_cnpm_publish_time":1436294392902,"_hasShrinkwrap":false},"0.0.5":{"name":"spark-md5","version":"0.0.5","description":"Lightning fast normal and incremental md5 for javascript","main":"spark-md5.js","directories":{"test":"test"},"repository":{"type":"git","url":"git@github.com:satazor/SparkMD5.git"},"keywords":["md5","fast","spark","incremental"],"author":{"name":"André Cruz","email":"andremiguelcruz@msn.com"},"license":"WTFPL","readmeFilename":"README.md","bugs":{"url":"https://github.com/satazor/SparkMD5/issues"},"_id":"spark-md5@0.0.5","dist":{"shasum":"931da5e3b951d06527e9b7d90dfff578b6fcdc8e","size":13171,"noattachment":false,"key":"/spark-md5/-/spark-md5-0.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/spark-md5/download/spark-md5-0.0.5.tgz"},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"publish_time":1383859695139,"_cnpm_publish_time":1383859695139,"_hasShrinkwrap":false}},"readme":"# SparkMD5\n\nSparkMD5 is a fast md5 implementation of the MD5 algorithm.\nThis script is based in the JKM md5 library which is the [fastest](http://jsperf.com/md5-shootout/7) algorithm around. This is most suitable for browser usage, because `nodejs` version might be faster.\n\nNOTE: Please disable Firebug while performing the test!\n      Firebug consumes a lot of memory and CPU and slows the test by a great margin.\n\n\n**[Demo](http://9px.ir/demo/incremental-md5.html)**\n\n## Install\n\n```sh\nnpm install --save spark-md5\n```\n\n## Improvements over the JKM md5 library\n\n * Strings are converted to utf8, like most server side algorithms\n * Fix computation for large amounts of data (overflow)\n * Incremental md5 (see below)\n * Support for array buffers (typed arrays)\n * Functionality wrapped in a closure, to avoid global assignments\n * Object oriented library\n * CommonJS (it can be used in node) and AMD integration\n * Code passed through JSHint and JSCS\n\n\nIncremental md5 performs a lot better for hashing large amounts of data, such as\nfiles. One could read files in chunks, using the FileReader & Blob's, and append\neach chunk for md5 hashing while keeping memory usage low. See example below.\n\n\n## Usage\n\n### Normal usage\n\n```js\nvar hexHash = SparkMD5.hash('Hi there');        // hex hash\nvar rawHash = SparkMD5.hash('Hi there', true);  // OR raw hash (binary string)\n```\n\n### Incremental usage\n\n```js\nvar spark = new SparkMD5();\nspark.append('Hi');\nspark.append(' there');\nvar hexHash = spark.end();                      // hex hash\nvar rawHash = spark.end(true);                  // OR raw hash (binary string)\n```\n\n### Hash a file incrementally\n\nNOTE: If you test the code bellow using the file:// protocol in chrome you must start the browser with -allow-file-access-from-files argument.\n      Please see: http://code.google.com/p/chromium/issues/detail?id=60889\n\n```js\ndocument.getElementById('file').addEventListener('change', function () {\n    var blobSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice,\n        file = this.files[0],\n        chunkSize = 2097152,                             // Read in chunks of 2MB\n        chunks = Math.ceil(file.size / chunkSize),\n        currentChunk = 0,\n        spark = new SparkMD5.ArrayBuffer(),\n        fileReader = new FileReader();\n\n    fileReader.onload = function (e) {\n        console.log('read chunk nr', currentChunk + 1, 'of', chunks);\n        spark.append(e.target.result);                   // Append array buffer\n        currentChunk++;\n\n        if (currentChunk < chunks) {\n            loadNext();\n        } else {\n            console.log('finished loading');\n            console.info('computed hash', spark.end());  // Compute hash\n        }\n    };\n\n    fileReader.onerror = function () {\n        console.warn('oops, something went wrong.');\n    };\n\n    function loadNext() {\n        var start = currentChunk * chunkSize,\n            end = ((start + chunkSize) >= file.size) ? file.size : start + chunkSize;\n\n        fileReader.readAsArrayBuffer(blobSlice.call(file, start, end));\n    }\n\n    loadNext();\n});\n```\n\nYou can see some more examples in the test folder.\n\n## Documentation\n\n\n### SparkMD5 class\n\n#### SparkMD5#append(str)\n\nAppends a string, encoding it to UTF8 if necessary.\n\n#### SparkMD5#appendBinary(str)\n\nAppends a binary string (e.g.: string returned from the deprecated [readAsBinaryString](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsBinaryString)).\n\n#### SparkMD5#end(raw)\n\nFinishes the computation of the md5, returning the hex result.\nIf `raw` is true, the result as a binary string will be returned instead.\n\n#### SparkMD5#reset()\n\nResets the internal state of the computation.\n\n#### SparkMD5#getState()\n\nReturns an object representing the internal computation state.\nYou can pass this state to setState(). This feature is useful to resume an incremental md5.\n\n#### SparkMD5#setState(state)\n\nSets the internal computation state. See: getState().\n\n#### SparkMD5#destroy()\n\nReleases memory used by the incremental buffer and other additional resources.\n\n#### SparkMD5.hash(str, raw)\n\nHashes a string directly, returning the hex result.\nIf `raw` is true, the result as a binary string will be returned instead.\nNote that this function is `static`.\n\n#### SparkMD5.hashBinary(str, raw)\n\nHashes a binary string directly (e.g.: string returned from the deprecated [readAsBinaryString](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsBinaryString)), returning the hex result.\nIf `raw` is true, the result as a binary string will be returned instead.\nNote that this function is `static`.\n\n\n### SparkMD5.ArrayBuffer class\n\n#### SparkMD5.ArrayBuffer#append(arr)\n\nAppends an array buffer.\n\n#### SparkMD5.ArrayBuffer#end(raw)\n\nFinishes the computation of the md5, returning the hex result.\nIf `raw` is true, the result as a binary string will be returned instead.\n\n#### SparkMD5.ArrayBuffer#reset()\n\nResets the internal state of the computation.\n\n#### SparkMD5.ArrayBuffer#destroy()\n\nReleases memory used by the incremental buffer and other additional resources.\n\n#### SparkMD5.ArrayBuffer#getState()\n\nReturns an object representing the internal computation state.\nYou can pass this state to setState(). This feature is useful to resume an incremental md5.\n\n#### SparkMD5.ArrayBuffer#setState(state)\n\nSets the internal computation state. See: getState().\n\n#### SparkMD5.ArrayBuffer.hash(arr, raw)\n\nHashes an array buffer directly, returning the hex result.\nIf `raw` is true, the result as a binary string will be returned instead.\nNote that this function is `static`.\n\n\n## License\n\nThe project is double licensed, being [WTF2](./LICENSE) the master license and [MIT](./LICENSE2) the alternative license.\nThe reason to have two licenses is that some entities refuse to use the master license (WTF2) due to\nbad language. If that's also your case, you can choose the alternative license.\n\n\n## Credits\n\n[Joseph Myers](http://www.myersdaily.org/joseph/javascript/md5-text.html)\n","_attachments":{},"homepage":"https://github.com/satazor/js-spark-md5#readme","bugs":{"url":"https://github.com/satazor/js-spark-md5/issues"},"license":"(WTFPL OR MIT)"}