Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorForrest L Norvell <forrest@npmjs.com>2015-12-04 02:04:48 +0300
committerForrest L Norvell <forrest@npmjs.com>2015-12-04 02:04:48 +0300
commitdba1b2402aaa2beceec798d3bd22d00650e01069 (patch)
tree648a1736c1e68fd1b71447aa7140b50d860a88b0 /node_modules/imurmurhash
parent8347a308ef0d2cf0f58f96bba3635af642ec611f (diff)
write-file-atomic@1.1.4
Don't need to use MD5 (which interferes with using npm with a FIPS-compliant Node.js binary), and murmur is faster anyway. Fixes: #10629 Credit: @othiym23
Diffstat (limited to 'node_modules/imurmurhash')
-rw-r--r--node_modules/imurmurhash/README.md122
-rw-r--r--node_modules/imurmurhash/imurmurhash.js138
-rw-r--r--node_modules/imurmurhash/imurmurhash.min.js12
-rw-r--r--node_modules/imurmurhash/package.json85
4 files changed, 357 insertions, 0 deletions
diff --git a/node_modules/imurmurhash/README.md b/node_modules/imurmurhash/README.md
new file mode 100644
index 000000000..f35b20a0e
--- /dev/null
+++ b/node_modules/imurmurhash/README.md
@@ -0,0 +1,122 @@
+iMurmurHash.js
+==============
+
+An incremental implementation of the MurmurHash3 (32-bit) hashing algorithm for JavaScript based on [Gary Court's implementation](https://github.com/garycourt/murmurhash-js) with [kazuyukitanimura's modifications](https://github.com/kazuyukitanimura/murmurhash-js).
+
+This version works significantly faster than the non-incremental version if you need to hash many small strings into a single hash, since string concatenation (to build the single string to pass the non-incremental version) is fairly costly. In one case tested, using the incremental version was about 50% faster than concatenating 5-10 strings and then hashing.
+
+Installation
+------------
+
+To use iMurmurHash in the browser, [download the latest version](https://raw.github.com/jensyt/imurmurhash-js/master/imurmurhash.min.js) and include it as a script on your site.
+
+```html
+<script type="text/javascript" src="/scripts/imurmurhash.min.js"></script>
+<script>
+// Your code here, access iMurmurHash using the global object MurmurHash3
+</script>
+```
+
+---
+
+To use iMurmurHash in Node.js, install the module using NPM:
+
+```bash
+npm install imurmurhash
+```
+
+Then simply include it in your scripts:
+
+```javascript
+MurmurHash3 = require('imurmurhash');
+```
+
+Quick Example
+-------------
+
+```javascript
+// Create the initial hash
+var hashState = MurmurHash3('string');
+
+// Incrementally add text
+hashState.hash('more strings');
+hashState.hash('even more strings');
+
+// All calls can be chained if desired
+hashState.hash('and').hash('some').hash('more');
+
+// Get a result
+hashState.result();
+// returns 0xe4ccfe6b
+```
+
+Functions
+---------
+
+### MurmurHash3 ([string], [seed])
+Get a hash state object, optionally initialized with the given _string_ and _seed_. _Seed_ must be a positive integer if provided. Calling this function without the `new` keyword will return a cached state object that has been reset. This is safe to use as long as the object is only used from a single thread and no other hashes are created while operating on this one. If this constraint cannot be met, you can use `new` to create a new state object. For example:
+
+```javascript
+// Use the cached object, calling the function again will return the same
+// object (but reset, so the current state would be lost)
+hashState = MurmurHash3();
+...
+
+// Create a new object that can be safely used however you wish. Calling the
+// function again will simply return a new state object, and no state loss
+// will occur, at the cost of creating more objects.
+hashState = new MurmurHash3();
+```
+
+Both methods can be mixed however you like if you have different use cases.
+
+---
+
+### MurmurHash3.prototype.hash (string)
+Incrementally add _string_ to the hash. This can be called as many times as you want for the hash state object, including after a call to `result()`. Returns `this` so calls can be chained.
+
+---
+
+### MurmurHash3.prototype.result ()
+Get the result of the hash as a 32-bit positive integer. This performs the tail and finalizer portions of the algorithm, but does not store the result in the state object. This means that it is perfectly safe to get results and then continue adding strings via `hash`.
+
+```javascript
+// Do the whole string at once
+MurmurHash3('this is a test string').result();
+// 0x70529328
+
+// Do part of the string, get a result, then the other part
+var m = MurmurHash3('this is a');
+m.result();
+// 0xbfc4f834
+m.hash(' test string').result();
+// 0x70529328 (same as above)
+```
+
+---
+
+### MurmurHash3.prototype.reset ([seed])
+Reset the state object for reuse, optionally using the given _seed_ (defaults to 0 like the constructor). Returns `this` so calls can be chained.
+
+---
+
+License (MIT)
+-------------
+Copyright (c) 2013 Gary Court, Jens Taylor
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/imurmurhash/imurmurhash.js b/node_modules/imurmurhash/imurmurhash.js
new file mode 100644
index 000000000..e63146a2b
--- /dev/null
+++ b/node_modules/imurmurhash/imurmurhash.js
@@ -0,0 +1,138 @@
+/**
+ * @preserve
+ * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013)
+ *
+ * @author <a href="mailto:jensyt@gmail.com">Jens Taylor</a>
+ * @see http://github.com/homebrewing/brauhaus-diff
+ * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
+ * @see http://github.com/garycourt/murmurhash-js
+ * @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
+ * @see http://sites.google.com/site/murmurhash/
+ */
+(function(){
+ var cache;
+
+ // Call this function without `new` to use the cached object (good for
+ // single-threaded environments), or with `new` to create a new object.
+ //
+ // @param {string} key A UTF-16 or ASCII string
+ // @param {number} seed An optional positive integer
+ // @return {object} A MurmurHash3 object for incremental hashing
+ function MurmurHash3(key, seed) {
+ var m = this instanceof MurmurHash3 ? this : cache;
+ m.reset(seed)
+ if (typeof key === 'string' && key.length > 0) {
+ m.hash(key);
+ }
+
+ if (m !== this) {
+ return m;
+ }
+ };
+
+ // Incrementally add a string to this hash
+ //
+ // @param {string} key A UTF-16 or ASCII string
+ // @return {object} this
+ MurmurHash3.prototype.hash = function(key) {
+ var h1, k1, i, top, len;
+
+ len = key.length;
+ this.len += len;
+
+ k1 = this.k1;
+ i = 0;
+ switch (this.rem) {
+ case 0: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) : 0;
+ case 1: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 8 : 0;
+ case 2: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 16 : 0;
+ case 3:
+ k1 ^= len > i ? (key.charCodeAt(i) & 0xff) << 24 : 0;
+ k1 ^= len > i ? (key.charCodeAt(i++) & 0xff00) >> 8 : 0;
+ }
+
+ this.rem = (len + this.rem) & 3; // & 3 is same as % 4
+ len -= this.rem;
+ if (len > 0) {
+ h1 = this.h1;
+ while (1) {
+ k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff;
+ k1 = (k1 << 15) | (k1 >>> 17);
+ k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff;
+
+ h1 ^= k1;
+ h1 = (h1 << 13) | (h1 >>> 19);
+ h1 = (h1 * 5 + 0xe6546b64) & 0xffffffff;
+
+ if (i >= len) {
+ break;
+ }
+
+ k1 = ((key.charCodeAt(i++) & 0xffff)) ^
+ ((key.charCodeAt(i++) & 0xffff) << 8) ^
+ ((key.charCodeAt(i++) & 0xffff) << 16);
+ top = key.charCodeAt(i++);
+ k1 ^= ((top & 0xff) << 24) ^
+ ((top & 0xff00) >> 8);
+ }
+
+ k1 = 0;
+ switch (this.rem) {
+ case 3: k1 ^= (key.charCodeAt(i + 2) & 0xffff) << 16;
+ case 2: k1 ^= (key.charCodeAt(i + 1) & 0xffff) << 8;
+ case 1: k1 ^= (key.charCodeAt(i) & 0xffff);
+ }
+
+ this.h1 = h1;
+ }
+
+ this.k1 = k1;
+ return this;
+ };
+
+ // Get the result of this hash
+ //
+ // @return {number} The 32-bit hash
+ MurmurHash3.prototype.result = function() {
+ var k1, h1;
+
+ k1 = this.k1;
+ h1 = this.h1;
+
+ if (k1 > 0) {
+ k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff;
+ k1 = (k1 << 15) | (k1 >>> 17);
+ k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff;
+ h1 ^= k1;
+ }
+
+ h1 ^= this.len;
+
+ h1 ^= h1 >>> 16;
+ h1 = (h1 * 0xca6b + (h1 & 0xffff) * 0x85eb0000) & 0xffffffff;
+ h1 ^= h1 >>> 13;
+ h1 = (h1 * 0xae35 + (h1 & 0xffff) * 0xc2b20000) & 0xffffffff;
+ h1 ^= h1 >>> 16;
+
+ return h1 >>> 0;
+ };
+
+ // Reset the hash object for reuse
+ //
+ // @param {number} seed An optional positive integer
+ MurmurHash3.prototype.reset = function(seed) {
+ this.h1 = typeof seed === 'number' ? seed : 0;
+ this.rem = this.k1 = this.len = 0;
+ return this;
+ };
+
+ // A cached object to use. This can be safely used if you're in a single-
+ // threaded environment, otherwise you need to create new hashes to use.
+ cache = new MurmurHash3();
+
+ if (typeof(module) != 'undefined') {
+ module.exports = MurmurHash3;
+ } else {
+ this.MurmurHash3 = MurmurHash3;
+ }
+}());
diff --git a/node_modules/imurmurhash/imurmurhash.min.js b/node_modules/imurmurhash/imurmurhash.min.js
new file mode 100644
index 000000000..dc0ee88d6
--- /dev/null
+++ b/node_modules/imurmurhash/imurmurhash.min.js
@@ -0,0 +1,12 @@
+/**
+ * @preserve
+ * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013)
+ *
+ * @author <a href="mailto:jensyt@gmail.com">Jens Taylor</a>
+ * @see http://github.com/homebrewing/brauhaus-diff
+ * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
+ * @see http://github.com/garycourt/murmurhash-js
+ * @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
+ * @see http://sites.google.com/site/murmurhash/
+ */
+!function(){function t(h,r){var s=this instanceof t?this:e;return s.reset(r),"string"==typeof h&&h.length>0&&s.hash(h),s!==this?s:void 0}var e;t.prototype.hash=function(t){var e,h,r,s,i;switch(i=t.length,this.len+=i,h=this.k1,r=0,this.rem){case 0:h^=i>r?65535&t.charCodeAt(r++):0;case 1:h^=i>r?(65535&t.charCodeAt(r++))<<8:0;case 2:h^=i>r?(65535&t.charCodeAt(r++))<<16:0;case 3:h^=i>r?(255&t.charCodeAt(r))<<24:0,h^=i>r?(65280&t.charCodeAt(r++))>>8:0}if(this.rem=3&i+this.rem,i-=this.rem,i>0){for(e=this.h1;;){if(h=4294967295&11601*h+3432906752*(65535&h),h=h<<15|h>>>17,h=4294967295&13715*h+461832192*(65535&h),e^=h,e=e<<13|e>>>19,e=4294967295&5*e+3864292196,r>=i)break;h=65535&t.charCodeAt(r++)^(65535&t.charCodeAt(r++))<<8^(65535&t.charCodeAt(r++))<<16,s=t.charCodeAt(r++),h^=(255&s)<<24^(65280&s)>>8}switch(h=0,this.rem){case 3:h^=(65535&t.charCodeAt(r+2))<<16;case 2:h^=(65535&t.charCodeAt(r+1))<<8;case 1:h^=65535&t.charCodeAt(r)}this.h1=e}return this.k1=h,this},t.prototype.result=function(){var t,e;return t=this.k1,e=this.h1,t>0&&(t=4294967295&11601*t+3432906752*(65535&t),t=t<<15|t>>>17,t=4294967295&13715*t+461832192*(65535&t),e^=t),e^=this.len,e^=e>>>16,e=4294967295&51819*e+2246770688*(65535&e),e^=e>>>13,e=4294967295&44597*e+3266445312*(65535&e),e^=e>>>16,e>>>0},t.prototype.reset=function(t){return this.h1="number"==typeof t?t:0,this.rem=this.k1=this.len=0,this},e=new t,"undefined"!=typeof module?module.exports=t:this.MurmurHash3=t}(); \ No newline at end of file
diff --git a/node_modules/imurmurhash/package.json b/node_modules/imurmurhash/package.json
new file mode 100644
index 000000000..a8d0b1746
--- /dev/null
+++ b/node_modules/imurmurhash/package.json
@@ -0,0 +1,85 @@
+{
+ "_args": [
+ [
+ "imurmurhash@^0.1.4",
+ "/Users/ogd/Documents/projects/npm/npm/node_modules/fs-write-stream-atomic"
+ ]
+ ],
+ "_from": "imurmurhash@>=0.1.4 <0.2.0",
+ "_id": "imurmurhash@0.1.4",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/imurmurhash",
+ "_npmUser": {
+ "email": "jensyt@gmail.com",
+ "name": "jensyt"
+ },
+ "_npmVersion": "1.3.2",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "imurmurhash",
+ "raw": "imurmurhash@^0.1.4",
+ "rawSpec": "^0.1.4",
+ "scope": null,
+ "spec": ">=0.1.4 <0.2.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/fs-write-stream-atomic"
+ ],
+ "_resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+ "_shasum": "9218b9b2b928a238b13dc4fb6b6d576f231453ea",
+ "_shrinkwrap": null,
+ "_spec": "imurmurhash@^0.1.4",
+ "_where": "/Users/ogd/Documents/projects/npm/npm/node_modules/fs-write-stream-atomic",
+ "author": {
+ "email": "jensyt@gmail.com",
+ "name": "Jens Taylor",
+ "url": "https://github.com/homebrewing"
+ },
+ "bugs": {
+ "url": "https://github.com/jensyt/imurmurhash-js/issues"
+ },
+ "dependencies": {},
+ "description": "An incremental implementation of MurmurHash3",
+ "devDependencies": {},
+ "directories": {},
+ "dist": {
+ "shasum": "9218b9b2b928a238b13dc4fb6b6d576f231453ea",
+ "tarball": "http://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz"
+ },
+ "engines": {
+ "node": ">=0.8.19"
+ },
+ "files": [
+ "README.md",
+ "imurmurhash.js",
+ "imurmurhash.min.js",
+ "package.json"
+ ],
+ "homepage": "https://github.com/jensyt/imurmurhash-js",
+ "keywords": [
+ "hash",
+ "incremental",
+ "murmur",
+ "murmurhash",
+ "murmurhash3"
+ ],
+ "license": "MIT",
+ "main": "imurmurhash.js",
+ "maintainers": [
+ {
+ "name": "jensyt",
+ "email": "jensyt@gmail.com"
+ }
+ ],
+ "name": "imurmurhash",
+ "optionalDependencies": {},
+ "readme": "iMurmurHash.js\n==============\n\nAn incremental implementation of the MurmurHash3 (32-bit) hashing algorithm for JavaScript based on [Gary Court's implementation](https://github.com/garycourt/murmurhash-js) with [kazuyukitanimura's modifications](https://github.com/kazuyukitanimura/murmurhash-js).\n\nThis version works significantly faster than the non-incremental version if you need to hash many small strings into a single hash, since string concatenation (to build the single string to pass the non-incremental version) is fairly costly. In one case tested, using the incremental version was about 50% faster than concatenating 5-10 strings and then hashing.\n\nInstallation\n------------\n\nTo use iMurmurHash in the browser, [download the latest version](https://raw.github.com/jensyt/imurmurhash-js/master/imurmurhash.min.js) and include it as a script on your site.\n\n```html\n<script type=\"text/javascript\" src=\"/scripts/imurmurhash.min.js\"></script>\n<script>\n// Your code here, access iMurmurHash using the global object MurmurHash3\n</script>\n```\n\n---\n\nTo use iMurmurHash in Node.js, install the module using NPM:\n\n```bash\nnpm install imurmurhash\n```\n\nThen simply include it in your scripts:\n\n```javascript\nMurmurHash3 = require('imurmurhash');\n```\n\nQuick Example\n-------------\n\n```javascript\n// Create the initial hash\nvar hashState = MurmurHash3('string');\n\n// Incrementally add text\nhashState.hash('more strings');\nhashState.hash('even more strings');\n\n// All calls can be chained if desired\nhashState.hash('and').hash('some').hash('more');\n\n// Get a result\nhashState.result();\n// returns 0xe4ccfe6b\n```\n\nFunctions\n---------\n\n### MurmurHash3 ([string], [seed])\nGet a hash state object, optionally initialized with the given _string_ and _seed_. _Seed_ must be a positive integer if provided. Calling this function without the `new` keyword will return a cached state object that has been reset. This is safe to use as long as the object is only used from a single thread and no other hashes are created while operating on this one. If this constraint cannot be met, you can use `new` to create a new state object. For example:\n\n```javascript\n// Use the cached object, calling the function again will return the same\n// object (but reset, so the current state would be lost)\nhashState = MurmurHash3();\n...\n\n// Create a new object that can be safely used however you wish. Calling the\n// function again will simply return a new state object, and no state loss\n// will occur, at the cost of creating more objects.\nhashState = new MurmurHash3();\n```\n\nBoth methods can be mixed however you like if you have different use cases.\n\n---\n\n### MurmurHash3.prototype.hash (string)\nIncrementally add _string_ to the hash. This can be called as many times as you want for the hash state object, including after a call to `result()`. Returns `this` so calls can be chained.\n\n---\n\n### MurmurHash3.prototype.result ()\nGet the result of the hash as a 32-bit positive integer. This performs the tail and finalizer portions of the algorithm, but does not store the result in the state object. This means that it is perfectly safe to get results and then continue adding strings via `hash`.\n\n```javascript\n// Do the whole string at once\nMurmurHash3('this is a test string').result();\n// 0x70529328\n\n// Do part of the string, get a result, then the other part\nvar m = MurmurHash3('this is a');\nm.result();\n// 0xbfc4f834\nm.hash(' test string').result();\n// 0x70529328 (same as above)\n```\n\n---\n\n### MurmurHash3.prototype.reset ([seed])\nReset the state object for reuse, optionally using the given _seed_ (defaults to 0 like the constructor). Returns `this` so calls can be chained.\n\n---\n\nLicense (MIT)\n-------------\nCopyright (c) 2013 Gary Court, Jens Taylor\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
+ "readmeFilename": "README.md",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/jensyt/imurmurhash-js.git"
+ },
+ "version": "0.1.4"
+}