Socket
Socket
Sign inDemoInstall

pure-uuid

Package Overview
Dependencies
0
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.6.4 to 1.7.0

11

package.json

@@ -5,3 +5,3 @@ {

"description": "Pure JavaScript Based Universally Unique Identifier (UUID)",
"version": "1.6.4",
"version": "1.7.0",
"license": "MIT",

@@ -31,8 +31,8 @@ "author": {

"grunt-contrib-clean": "2.0.1",
"grunt-eslint": "24.2.0",
"grunt-eslint": "24.3.0",
"grunt-mocha-test": "0.13.3",
"eslint": "8.44.0",
"eslint": "8.47.0",
"eslint-config-standard": "17.1.0",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-import": "2.28.0",
"eslint-plugin-node": "11.1.0",

@@ -49,4 +49,5 @@ "chai": "4.3.7",

"prepublishOnly": "grunt default",
"build": "grunt default"
"build": "grunt default",
"test": "grunt mochaTest"
}
}

@@ -633,4 +633,27 @@ /*!

ui64_and(this.state, this.mask);
seed = ui64_n2i(seed !== undefined ?
(seed >>> 0) : ((Math.random() * 0xffffffff) >>> 0));
var arr;
if (seed !== undefined)
/* external seeding */
seed = ui64_n2i(seed >>> 0);
else if (typeof window === "object" &&
typeof window.crypto === "object" &&
typeof window.crypto.getRandomValues === "function") {
/* internal strong seeding with WebCrypto API (in browsers) */
arr = new Uint32Array(2);
window.crypto.getRandomValues(arr);
seed = ui64_or(ui64_n2i(arr[0] >>> 0), ui64_ror(ui64_n2i(arr[1] >>> 0), 32));
}
else if (typeof globalThis === "object" &&
typeof globalThis.crypto === "object" &&
typeof globalThis.crypto.getRandomValues === "function") {
/* internal strong seeding with WebCrypto API (in Node.js) */
arr = new Uint32Array(2);
globalThis.crypto.getRandomValues(arr);
seed = ui64_or(ui64_n2i(arr[0] >>> 0), ui64_ror(ui64_n2i(arr[1] >>> 0), 32));
}
else {
/* internal weak seeding with Math.random() and Date */
seed = ui64_n2i((Math.random() * 0xffffffff) >>> 0);
ui64_or(seed, ui64_ror(ui64_n2i((new Date()).getTime()), 32));
}
ui64_or(this.state, seed);

@@ -668,3 +691,11 @@ this.next();

};
PCG.prototype.reseed = function (seed) {
if (typeof seed !== "string")
throw new Error("UUID: PCG: seed: invalid argument (string expected)");
var arr = sha1_core(s2a(seed, { ibits: 8, obits: 32, obigendian: true }), seed.length * 8)
for (var i = 0; i < arr.length; i++)
ui64_xor(pcg.state, ui64_n2i((arr[i] >>> 0)));
}
var pcg = new PCG();
PCG.reseed = function (seed) { pcg.reseed(seed) };

@@ -671,0 +702,0 @@ /* utility function: simple Pseudo Random Number Generator (PRNG) */

@@ -1,1 +0,1 @@

!function(r,t){"function"==typeof define&&void 0!==define.amd?define(t):"object"==typeof module&&"object"==typeof module.exports?(module.exports=t(),module.exports.default=module.exports):r.UUID=t()}(this,function(){function e(r,t,o,e,i,n){for(var a=t;a<=o;a++)i[n++]=function(r,t){r=r.toString(16);return r.length<2&&(r="0"+r),r=t?r.toUpperCase():r}(r[a],e)}function h(r,t,o,e,i){for(var n=t;n<=o;n+=2)e[i++]=parseInt(r.substr(n,2),16)}function t(r,t){var o,e={ibits:8,obits:8,obigendian:!0};for(o in t)void 0!==e[o]&&(e[o]=t[o]);for(var i,n,a,f=[],s=0,u=0,h=0,p=r.length;i=(n=0===u?r.charCodeAt(s++):n)>>e.ibits-(u+8)&255,u=(u+8)%e.ibits,e.obigendian?0===h?a=i<<e.obits-8:a|=i<<e.obits-8-h:0===h?a=i:a|=i<<h,!(0===(h=(h+8)%e.obits)&&(f.push(a),p<=s)););return f}function o(r,t){var o,e={ibits:32,ibigendian:!0};for(o in t)void 0!==e[o]&&(e[o]=t[o]);for(var i="",n=4294967295,a=(e.ibits<32&&(n=(1<<e.ibits)-1),r.length),f=0;f<a;f++)for(var s=r[f]&n,u=0;u<e.ibits;u+=8)i+=e.ibigendian?String.fromCharCode(s>>e.ibits-8-u&255):String.fromCharCode(s>>u&255);return i}function v(r){return r.slice(0)}function l(r){for(var t=a(),o=0;o<I;o++)t[o]=Math.floor(r%M),r/=M;return t}function b(r){for(var t=0,o=I-1;0<=o;o--)t=(t*=M)+r[o];return Math.floor(t)}function m(r,t){for(var o=0,e=0;e<I;e++)o+=r[e]+t[e],r[e]=Math.floor(o%M),o=Math.floor(o/M)}function x(r,t){for(var o=0;o<I;o++)r[o]&=t[o]}function y(r,t){var o=a();if(t%8!=0)throw new Error("ui64_rorn: only bit rotations supported with a multiple of digit bits");for(var e=Math.floor(t/8),i=0;i<e;i++){for(var n=I-1-1;0<=n;n--)o[n+1]=o[n];for(o[0]=r[0],n=0;n<I-1;n++)r[n]=r[n+1];r[n]=0}return b(o)}function w(r,t){if(8*I<t)throw new Error("ui64_ror: invalid number of bits to shift");for(var o=new Array(I+I),e=0;e<I;e++)o[e+I]=r[e],o[e]=0;var i=Math.floor(t/8),n=t%8;for(e=i;e<I+I-1;e++)o[e-i]=255&(o[e]>>>n|o[e+1]<<8-n);for(o[I+I-1-i]=o[I+I-1]>>>n&255,e=I+I-1-i+1;e<I+I;e++)o[e]=0;for(e=0;e<I;e++)r[e]=o[e+I];o.slice(0,I)}function g(r,t){for(var o=0;o<I;o++)r[o]^=t[o]}function U(r){return o(function(r,t){r[t>>5]|=128<<24-t%32,r[15+(t+64>>9<<4)]=t;for(var o,e,i,n=Array(80),a=1732584193,f=-271733879,s=-1732584194,u=271733878,h=-1009589776,p=0;p<r.length;p+=16){for(var c=a,d=f,l=s,v=u,b=h,m=0;m<80;m++){n[m]=m<16?r[p+m]:k(n[m-3]^n[m-8]^n[m-14]^n[m-16],1);var x=j(j(k(a,5),(x=f,e=s,i=u,(o=m)<20?x&e|~x&i:!(o<40)&&o<60?x&e|x&i|e&i:x^e^i)),j(j(h,n[m]),(o=m)<20?1518500249:o<40?1859775393:o<60?-1894007588:-899497514)),h=u,u=s,s=k(f,30),f=a,a=x}a=j(a,c),f=j(f,d),s=j(s,l),u=j(u,v),h=j(h,b)}return[a,f,s,u,h]}(t(r,{ibits:8,obits:32,obigendian:!0}),8*r.length),{ibits:32,ibigendian:!0})}function A(r){return o(function(r,t){function f(r,t,o,e,i,n){return j(k(j(j(t,r),j(e,n)),i),o)}function o(r,t,o,e,i,n,a){return f(t&o|~t&e,r,t,i,n,a)}function e(r,t,o,e,i,n,a){return f(t&e|o&~e,r,t,i,n,a)}function i(r,t,o,e,i,n,a){return f(t^o^e,r,t,i,n,a)}function n(r,t,o,e,i,n,a){return f(o^(t|~e),r,t,i,n,a)}r[t>>5]|=128<<t%32,r[14+(t+64>>>9<<4)]=t;for(var a=1732584193,s=-271733879,u=-1732584194,h=271733878,p=0;p<r.length;p+=16){var c=a,d=s,l=u,v=h,a=o(a,s,u,h,r[p+0],7,-680876936),h=o(h,a,s,u,r[p+1],12,-389564586),u=o(u,h,a,s,r[p+2],17,606105819),s=o(s,u,h,a,r[p+3],22,-1044525330);a=o(a,s,u,h,r[p+4],7,-176418897),h=o(h,a,s,u,r[p+5],12,1200080426),u=o(u,h,a,s,r[p+6],17,-1473231341),s=o(s,u,h,a,r[p+7],22,-45705983),a=o(a,s,u,h,r[p+8],7,1770035416),h=o(h,a,s,u,r[p+9],12,-1958414417),u=o(u,h,a,s,r[p+10],17,-42063),s=o(s,u,h,a,r[p+11],22,-1990404162),a=o(a,s,u,h,r[p+12],7,1804603682),h=o(h,a,s,u,r[p+13],12,-40341101),u=o(u,h,a,s,r[p+14],17,-1502002290),a=e(a,s=o(s,u,h,a,r[p+15],22,1236535329),u,h,r[p+1],5,-165796510),h=e(h,a,s,u,r[p+6],9,-1069501632),u=e(u,h,a,s,r[p+11],14,643717713),s=e(s,u,h,a,r[p+0],20,-373897302),a=e(a,s,u,h,r[p+5],5,-701558691),h=e(h,a,s,u,r[p+10],9,38016083),u=e(u,h,a,s,r[p+15],14,-660478335),s=e(s,u,h,a,r[p+4],20,-405537848),a=e(a,s,u,h,r[p+9],5,568446438),h=e(h,a,s,u,r[p+14],9,-1019803690),u=e(u,h,a,s,r[p+3],14,-187363961),s=e(s,u,h,a,r[p+8],20,1163531501),a=e(a,s,u,h,r[p+13],5,-1444681467),h=e(h,a,s,u,r[p+2],9,-51403784),u=e(u,h,a,s,r[p+7],14,1735328473),a=i(a,s=e(s,u,h,a,r[p+12],20,-1926607734),u,h,r[p+5],4,-378558),h=i(h,a,s,u,r[p+8],11,-2022574463),u=i(u,h,a,s,r[p+11],16,1839030562),s=i(s,u,h,a,r[p+14],23,-35309556),a=i(a,s,u,h,r[p+1],4,-1530992060),h=i(h,a,s,u,r[p+4],11,1272893353),u=i(u,h,a,s,r[p+7],16,-155497632),s=i(s,u,h,a,r[p+10],23,-1094730640),a=i(a,s,u,h,r[p+13],4,681279174),h=i(h,a,s,u,r[p+0],11,-358537222),u=i(u,h,a,s,r[p+3],16,-722521979),s=i(s,u,h,a,r[p+6],23,76029189),a=i(a,s,u,h,r[p+9],4,-640364487),h=i(h,a,s,u,r[p+12],11,-421815835),u=i(u,h,a,s,r[p+15],16,530742520),a=n(a,s=i(s,u,h,a,r[p+2],23,-995338651),u,h,r[p+0],6,-198630844),h=n(h,a,s,u,r[p+7],10,1126891415),u=n(u,h,a,s,r[p+14],15,-1416354905),s=n(s,u,h,a,r[p+5],21,-57434055),a=n(a,s,u,h,r[p+12],6,1700485571),h=n(h,a,s,u,r[p+3],10,-1894986606),u=n(u,h,a,s,r[p+10],15,-1051523),s=n(s,u,h,a,r[p+1],21,-2054922799),a=n(a,s,u,h,r[p+8],6,1873313359),h=n(h,a,s,u,r[p+15],10,-30611744),u=n(u,h,a,s,r[p+6],15,-1560198380),s=n(s,u,h,a,r[p+13],21,1309151649),a=n(a,s,u,h,r[p+4],6,-145523070),h=n(h,a,s,u,r[p+11],10,-1120210379),u=n(u,h,a,s,r[p+2],15,718787259),s=n(s,u,h,a,r[p+9],21,-343485551),a=j(a,c),s=j(s,d),u=j(u,l),h=j(h,v)}return[a,s,u,h]}(t(r,{ibits:8,obits:32,obigendian:!1}),8*r.length),{ibits:32,ibigendian:!1})}function r(r){this.mul=C(88,81,244,45,76,149,127,45),this.inc=C(20,5,123,126,247,103,129,79),this.mask=C(0,0,0,0,255,255,255,255),this.state=v(this.inc),this.next(),x(this.state,this.mask),r=l(void 0!==r?r>>>0:4294967295*Math.random()>>>0);for(var t=this.state,o=r,e=0;e<I;e++)t[e]|=o[e];this.next()}function D(r,t){for(var o=[],e=0;e<r;e++)o[e]=i.next()%t;return o}function E(){if(1===arguments.length&&"string"==typeof arguments[0])this.parse.apply(this,arguments);else if(1<=arguments.length&&"number"==typeof arguments[0])this.make.apply(this,arguments);else{if(1<=arguments.length)throw new Error("UUID: constructor: invalid arguments");for(var r=0;r<16;r++)this[r]=0}}var f="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#".split(""),p=[0,68,0,84,83,82,72,0,75,76,70,65,0,63,62,69,0,1,2,3,4,5,6,7,8,9,64,0,73,66,74,71,81,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,77,0,78,67,0,0,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,79,0,80,0,0],I=8,M=256,C=function(r,t,o,e,i,n,a,f){return[f,a,n,i,e,o,t,r]},a=function(){return C(0,0,0,0,0,0,0,0)},j=function(r,t){var o=(65535&r)+(65535&t);return(r>>16)+(t>>16)+(o>>16)<<16|65535&o},k=function(r,t){return r<<t&4294967295|r>>>32-t&4294967295},i=(r.prototype.next=function(){for(var r,t,o=v(this.state),e=this.state,i=this.mul,n=new Array(I+I),a=0;a<I+I;a++)n[a]=0;for(a=0;a<I;a++){for(r=t=0;r<I;r++)t+=e[a]*i[r]+n[a+r],n[a+r]=t%M,t/=M;for(;r<I+I-a;r++)t+=n[a+r],n[a+r]=t%M,t/=M}for(a=0;a<I;a++)e[a]=n[a];n.slice(I,I),m(this.state,this.inc);var f=v(o),o=(w(f,18),g(f,o),w(f,27),v(o)),o=(w(o,59),x(f,this.mask),b(o)),s=v(f),u=s,h=32-o;if(8*I<h)throw new Error("ui64_rol: invalid number of bits to shift");for(var p=new Array(I+I),c=0;c<I;c++)p[c+I]=0,p[c]=u[c];var d=Math.floor(h/8),l=h%8;for(c=I-1-d;0<c;c--)p[c+d]=255&(p[c]<<l|p[c-1]>>>8-l);for(p[0+d]=p[0]<<l&255,c=0+d-1;0<=c;c--)p[c]=0;for(c=0;c<I;c++)u[c]=p[c];return p.slice(I,I),w(f,o),g(f,s),b(f)},new r),S=0,F=0;return"undefined"!=typeof Uint8Array?E.prototype=new Uint8Array(16):Buffer?E.prototype=Buffer.alloc(16):E.prototype=new Array(16),(E.prototype.constructor=E).prototype.make=function(r){var t=this;if(1===r){for(var o,e=(new Date).getTime(),e=(e!==S?F=0:F++,l(S=e)),i=e,n=1e4,a=0,f=0;f<I;f++)a+=i[f]*n,i[f]=Math.floor(a%M),a=Math.floor(a/M);m(e,C(1,178,29,210,19,129,64,0)),0<F&&m(e,l(F)),o=y(e,8),t[3]=255&o,o=y(e,8),t[2]=255&o,o=y(e,8),t[1]=255&o,o=y(e,8),t[0]=255&o,o=y(e,8),t[5]=255&o,o=y(e,8),t[4]=255&o,o=y(e,8),t[7]=255&o,o=y(e,8),t[6]=15&o;var e=D(2,255),s=(t[8]=e[0],t[9]=e[1],D(6,255));for(s[0]|=1,s[0]|=2,h=0;h<6;h++)t[10+h]=s[h]}else if(4===r)for(var u=D(16,255),h=0;h<16;h++)this[h]=u[h];else{if(3!==r&&5!==r)throw new Error("UUID: make: invalid version");var p="",c="object"==typeof arguments[1]&&arguments[1]instanceof E?arguments[1]:(new E).parse(arguments[1]);for(h=0;h<16;h++)p+=String.fromCharCode(c[h]);var d=(3===r?A:U)(p+=arguments[2]);for(h=0;h<16;h++)t[h]=d.charCodeAt(h)}return t[6]&=15,t[6]|=r<<4,t[8]&=63,t[8]|=128,t},E.prototype.format=function(r){var t,o;return"z85"===r?t=function(r,t){if(t%4!=0)throw new Error("z85_encode: invalid input length (multiple of 4 expected)");for(var o="",e=0,i=0;e<t;)if(i=256*i+r[e++],e%4==0){for(var n=52200625;1<=n;){var a=Math.floor(i/n)%85;o+=f[a],n/=85}i=0}return o}(this,16):"b16"===r?(o=Array(32),e(this,0,15,!0,o,0),t=o.join("")):void 0!==r&&"std"!==r||(o=new Array(36),e(this,0,3,!1,o,0),o[8]="-",e(this,4,5,!1,o,9),o[13]="-",e(this,6,7,!1,o,14),o[18]="-",e(this,8,9,!1,o,19),o[23]="-",e(this,10,15,!1,o,24),t=o.join("")),t},E.prototype.toString=function(r){return this.format(r)},E.prototype.toJSON=function(){return this.format("std")},E.prototype.parse=function(r,t){if("string"!=typeof r)throw new Error("UUID: parse: invalid argument (type string expected)");if("z85"===t){var o=r;var e=this;var i=o.length;if(i%5!=0)throw new Error("z85_decode: invalid input length (multiple of 5 expected)");void 0===e&&(e=new Array(4*i/5));for(var n=0,a=0,f=0;n<i;){var s=o.charCodeAt(n++)-32;if(s<0||p.length<=s)break;if(f=85*f+p[s],n%5==0){for(var u=16777216;1<=u;)e[a++]=Math.trunc(f/u%256),u/=256;f=0}}}else if("b16"===t)h(r,0,35,this,0);else if(void 0===t||"std"===t){t={nil:"00000000-0000-0000-0000-000000000000","ns:DNS":"6ba7b810-9dad-11d1-80b4-00c04fd430c8","ns:URL":"6ba7b811-9dad-11d1-80b4-00c04fd430c8","ns:OID":"6ba7b812-9dad-11d1-80b4-00c04fd430c8","ns:X500":"6ba7b814-9dad-11d1-80b4-00c04fd430c8"};if(void 0!==t[r])r=t[r];else if(!r.match(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/))throw new Error('UUID: parse: invalid string representation (expected "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")');h(r,0,7,this,0),h(r,9,12,this,4),h(r,14,17,this,6),h(r,19,22,this,8),h(r,24,35,this,10)}return this},E.prototype.export=function(){for(var r=Array(16),t=0;t<16;t++)r[t]=this[t];return r},E.prototype.import=function(r){if(!("object"==typeof r&&r instanceof Array))throw new Error("UUID: import: invalid argument (type Array expected)");if(16!==r.length)throw new Error("UUID: import: invalid argument (Array of length 16 expected)");for(var t=0;t<16;t++){if("number"!=typeof r[t])throw new Error("UUID: import: invalid array element #"+t+" (type Number expected)");if(!isFinite(r[t])||Math.floor(r[t])!==r[t])throw new Error("UUID: import: invalid array element #"+t+" (Number with integer value expected)");if(!(0<=r[t]&&r[t]<=255))throw new Error("UUID: import: invalid array element #"+t+" (Number with integer value in range 0...255 expected)");this[t]=r[t]}return this},E.prototype.compare=function(r){if("object"!=typeof r)throw new Error("UUID: compare: invalid argument (type UUID expected)");if(!(r instanceof E))throw new Error("UUID: compare: invalid argument (type UUID expected)");for(var t=0;t<16;t++){if(this[t]<r[t])return-1;if(this[t]>r[t])return 1}return 0},E.prototype.equal=function(r){return 0===this.compare(r)},E.prototype.fold=function(r){if(void 0===r)throw new Error("UUID: fold: invalid argument (number of fold operations expected)");if(r<1||4<r)throw new Error("UUID: fold: invalid argument (1-4 fold operations expected)");for(var t=16/Math.pow(2,r),o=new Array(t),e=0;e<t;e++){for(var i=0,n=0;e+n<16;n+=t)i^=this[e+n];o[e]=i}return o},E.PCG=r,E});
!function(r,t){"function"==typeof define&&void 0!==define.amd?define(t):"object"==typeof module&&"object"==typeof module.exports?(module.exports=t(),module.exports.default=module.exports):r.UUID=t()}(this,function(){function o(r,t,e,o,i,n){for(var a=t;a<=e;a++)i[n++]=function(r,t){r=r.toString(16);return r.length<2&&(r="0"+r),r=t?r.toUpperCase():r}(r[a],o)}function h(r,t,e,o,i){for(var n=t;n<=e;n+=2)o[i++]=parseInt(r.substr(n,2),16)}function l(r,t){var e,o={ibits:8,obits:8,obigendian:!0};for(e in t)void 0!==o[e]&&(o[e]=t[e]);for(var i,n,a,f=[],s=0,u=0,h=0,p=r.length;i=(n=0===u?r.charCodeAt(s++):n)>>o.ibits-(u+8)&255,u=(u+8)%o.ibits,o.obigendian?0===h?a=i<<o.obits-8:a|=i<<o.obits-8-h:0===h?a=i:a|=i<<h,!(0===(h=(h+8)%o.obits)&&(f.push(a),p<=s)););return f}function v(r,t){var e,o={ibits:32,ibigendian:!0};for(e in t)void 0!==o[e]&&(o[e]=t[e]);for(var i="",n=4294967295,a=(o.ibits<32&&(n=(1<<o.ibits)-1),r.length),f=0;f<a;f++)for(var s=r[f]&n,u=0;u<o.ibits;u+=8)i+=o.ibigendian?String.fromCharCode(s>>o.ibits-8-u&255):String.fromCharCode(s>>u&255);return i}function b(r){return r.slice(0)}function y(r){for(var t=a(),e=0;e<C;e++)t[e]=Math.floor(r%k),r/=k;return t}function w(r){for(var t=0,e=C-1;0<=e;e--)t=(t*=k)+r[e];return Math.floor(t)}function g(r,t){for(var e=0,o=0;o<C;o++)e+=r[o]+t[o],r[o]=Math.floor(e%k),e=Math.floor(e/k)}function m(r,t){for(var e=0;e<C;e++)r[e]&=t[e]}function e(r,t){for(var e=0;e<C;e++)r[e]|=t[e];return r}function x(r,t){var e=a();if(t%j!=0)throw new Error("ui64_rorn: only bit rotations supported with a multiple of digit bits");for(var o=Math.floor(t/j),i=0;i<o;i++){for(var n=C-1-1;0<=n;n--)e[n+1]=e[n];for(e[0]=r[0],n=0;n<C-1;n++)r[n]=r[n+1];r[n]=0}return w(e)}function U(r,t){if(C*j<t)throw new Error("ui64_ror: invalid number of bits to shift");for(var e=new Array(C+C),o=0;o<C;o++)e[o+C]=r[o],e[o]=0;var i=Math.floor(t/j),n=t%j;for(o=i;o<C+C-1;o++)e[o-i]=(e[o]>>>n|e[o+1]<<j-n)&(1<<j)-1;for(e[C+C-1-i]=e[C+C-1]>>>n&(1<<j)-1,o=C+C-1-i+1;o<C+C;o++)e[o]=0;for(o=0;o<C;o++)r[o]=e[o+C];return e.slice(0,C)}function A(r,t){for(var e=0;e<C;e++)r[e]^=t[e]}function D(r,t){r[t>>5]|=128<<24-t%32,r[15+(t+64>>9<<4)]=t;for(var e,o,i,n=Array(80),a=1732584193,f=-271733879,s=-1732584194,u=271733878,h=-1009589776,p=0;p<r.length;p+=16){for(var c=a,d=f,l=s,v=u,b=h,y=0;y<80;y++){n[y]=y<16?r[p+y]:T(n[y-3]^n[y-8]^n[y-14]^n[y-16],1);var w=F(F(T(a,5),(w=f,o=s,i=u,(e=y)<20?w&o|~w&i:!(e<40)&&e<60?w&o|w&i|o&i:w^o^i)),F(F(h,n[y]),(e=y)<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514)),h=u,u=s,s=T(f,30),f=a,a=w}a=F(a,c),f=F(f,d),s=F(s,l),u=F(u,v),h=F(h,b)}return[a,f,s,u,h]}function E(r){return v(function(r,t){function f(r,t,e,o,i,n){return F(T(F(F(t,r),F(o,n)),i),e)}function e(r,t,e,o,i,n,a){return f(t&e|~t&o,r,t,i,n,a)}function o(r,t,e,o,i,n,a){return f(t&o|e&~o,r,t,i,n,a)}function i(r,t,e,o,i,n,a){return f(t^e^o,r,t,i,n,a)}function n(r,t,e,o,i,n,a){return f(e^(t|~o),r,t,i,n,a)}r[t>>5]|=128<<t%32,r[14+(t+64>>>9<<4)]=t;for(var a=1732584193,s=-271733879,u=-1732584194,h=271733878,p=0;p<r.length;p+=16){var c=a,d=s,l=u,v=h,a=e(a,s,u,h,r[p+0],7,-680876936),h=e(h,a,s,u,r[p+1],12,-389564586),u=e(u,h,a,s,r[p+2],17,606105819),s=e(s,u,h,a,r[p+3],22,-1044525330);a=e(a,s,u,h,r[p+4],7,-176418897),h=e(h,a,s,u,r[p+5],12,1200080426),u=e(u,h,a,s,r[p+6],17,-1473231341),s=e(s,u,h,a,r[p+7],22,-45705983),a=e(a,s,u,h,r[p+8],7,1770035416),h=e(h,a,s,u,r[p+9],12,-1958414417),u=e(u,h,a,s,r[p+10],17,-42063),s=e(s,u,h,a,r[p+11],22,-1990404162),a=e(a,s,u,h,r[p+12],7,1804603682),h=e(h,a,s,u,r[p+13],12,-40341101),u=e(u,h,a,s,r[p+14],17,-1502002290),a=o(a,s=e(s,u,h,a,r[p+15],22,1236535329),u,h,r[p+1],5,-165796510),h=o(h,a,s,u,r[p+6],9,-1069501632),u=o(u,h,a,s,r[p+11],14,643717713),s=o(s,u,h,a,r[p+0],20,-373897302),a=o(a,s,u,h,r[p+5],5,-701558691),h=o(h,a,s,u,r[p+10],9,38016083),u=o(u,h,a,s,r[p+15],14,-660478335),s=o(s,u,h,a,r[p+4],20,-405537848),a=o(a,s,u,h,r[p+9],5,568446438),h=o(h,a,s,u,r[p+14],9,-1019803690),u=o(u,h,a,s,r[p+3],14,-187363961),s=o(s,u,h,a,r[p+8],20,1163531501),a=o(a,s,u,h,r[p+13],5,-1444681467),h=o(h,a,s,u,r[p+2],9,-51403784),u=o(u,h,a,s,r[p+7],14,1735328473),a=i(a,s=o(s,u,h,a,r[p+12],20,-1926607734),u,h,r[p+5],4,-378558),h=i(h,a,s,u,r[p+8],11,-2022574463),u=i(u,h,a,s,r[p+11],16,1839030562),s=i(s,u,h,a,r[p+14],23,-35309556),a=i(a,s,u,h,r[p+1],4,-1530992060),h=i(h,a,s,u,r[p+4],11,1272893353),u=i(u,h,a,s,r[p+7],16,-155497632),s=i(s,u,h,a,r[p+10],23,-1094730640),a=i(a,s,u,h,r[p+13],4,681279174),h=i(h,a,s,u,r[p+0],11,-358537222),u=i(u,h,a,s,r[p+3],16,-722521979),s=i(s,u,h,a,r[p+6],23,76029189),a=i(a,s,u,h,r[p+9],4,-640364487),h=i(h,a,s,u,r[p+12],11,-421815835),u=i(u,h,a,s,r[p+15],16,530742520),a=n(a,s=i(s,u,h,a,r[p+2],23,-995338651),u,h,r[p+0],6,-198630844),h=n(h,a,s,u,r[p+7],10,1126891415),u=n(u,h,a,s,r[p+14],15,-1416354905),s=n(s,u,h,a,r[p+5],21,-57434055),a=n(a,s,u,h,r[p+12],6,1700485571),h=n(h,a,s,u,r[p+3],10,-1894986606),u=n(u,h,a,s,r[p+10],15,-1051523),s=n(s,u,h,a,r[p+1],21,-2054922799),a=n(a,s,u,h,r[p+8],6,1873313359),h=n(h,a,s,u,r[p+15],10,-30611744),u=n(u,h,a,s,r[p+6],15,-1560198380),s=n(s,u,h,a,r[p+13],21,1309151649),a=n(a,s,u,h,r[p+4],6,-145523070),h=n(h,a,s,u,r[p+11],10,-1120210379),u=n(u,h,a,s,r[p+2],15,718787259),s=n(s,u,h,a,r[p+9],21,-343485551),a=F(a,c),s=F(s,d),u=F(u,l),h=F(h,v)}return[a,s,u,h]}(l(r,{ibits:8,obits:32,obigendian:!1}),8*r.length),{ibits:32,ibigendian:!1})}function r(r){var t;this.mul=S(88,81,244,45,76,149,127,45),this.inc=S(20,5,123,126,247,103,129,79),this.mask=S(0,0,0,0,255,255,255,255),this.state=b(this.inc),this.next(),m(this.state,this.mask),void 0!==r?r=y(r>>>0):"object"==typeof window&&"object"==typeof window.crypto&&"function"==typeof window.crypto.getRandomValues?(t=new Uint32Array(2),window.crypto.getRandomValues(t),r=e(y(t[0]>>>0),U(y(t[1]>>>0),32))):"object"==typeof globalThis&&"object"==typeof globalThis.crypto&&"function"==typeof globalThis.crypto.getRandomValues?(t=new Uint32Array(2),globalThis.crypto.getRandomValues(t),r=e(y(t[0]>>>0),U(y(t[1]>>>0),32))):(r=y(4294967295*Math.random()>>>0),e(r,U(y((new Date).getTime()),32))),e(this.state,r),this.next()}function I(r,t){for(var e=[],o=0;o<r;o++)e[o]=i.next()%t;return e}function M(){if(1===arguments.length&&"string"==typeof arguments[0])this.parse.apply(this,arguments);else if(1<=arguments.length&&"number"==typeof arguments[0])this.make.apply(this,arguments);else{if(1<=arguments.length)throw new Error("UUID: constructor: invalid arguments");for(var r=0;r<16;r++)this[r]=0}}var f="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#".split(""),p=[0,68,0,84,83,82,72,0,75,76,70,65,0,63,62,69,0,1,2,3,4,5,6,7,8,9,64,0,73,66,74,71,81,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,77,0,78,67,0,0,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,79,0,80,0,0],C=8,j=8,k=256,S=function(r,t,e,o,i,n,a,f){return[f,a,n,i,o,e,t,r]},a=function(){return S(0,0,0,0,0,0,0,0)},F=function(r,t){var e=(65535&r)+(65535&t);return(r>>16)+(t>>16)+(e>>16)<<16|65535&e},T=function(r,t){return r<<t&4294967295|r>>>32-t&4294967295},i=(r.prototype.next=function(){for(var r,t,e=b(this.state),o=this.state,i=this.mul,n=new Array(C+C),a=0;a<C+C;a++)n[a]=0;for(a=0;a<C;a++){for(r=t=0;r<C;r++)t+=o[a]*i[r]+n[a+r],n[a+r]=t%k,t/=k;for(;r<C+C-a;r++)t+=n[a+r],n[a+r]=t%k,t/=k}for(a=0;a<C;a++)o[a]=n[a];n.slice(C,C),g(this.state,this.inc);var f=b(e),e=(U(f,18),A(f,e),U(f,27),b(e)),e=(U(e,59),m(f,this.mask),w(e)),s=b(f),u=s,h=32-e;if(C*j<h)throw new Error("ui64_rol: invalid number of bits to shift");for(var p=new Array(C+C),c=0;c<C;c++)p[c+C]=0,p[c]=u[c];var d=Math.floor(h/j),l=h%j;for(c=C-1-d;0<c;c--)p[c+d]=(p[c]<<l|p[c-1]>>>j-l)&(1<<j)-1;for(p[0+d]=p[0]<<l&(1<<j)-1,c=0+d-1;0<=c;c--)p[c]=0;for(c=0;c<C;c++)u[c]=p[c];return p.slice(C,C),U(f,e),A(f,s),w(f)},r.prototype.reseed=function(r){if("string"!=typeof r)throw new Error("UUID: PCG: seed: invalid argument (string expected)");for(var t=D(l(r,{ibits:8,obits:32,obigendian:!0}),8*r.length),e=0;e<t.length;e++)A(i.state,y(t[e]>>>0))},new r),N=(r.reseed=function(r){i.reseed(r)},0),R=0;return"undefined"!=typeof Uint8Array?M.prototype=new Uint8Array(16):Buffer?M.prototype=Buffer.alloc(16):M.prototype=new Array(16),(M.prototype.constructor=M).prototype.make=function(r){var t=this;if(1===r){for(var e,o=(new Date).getTime(),o=(o!==N?R=0:R++,y(N=o)),i=o,n=1e4,a=0,f=0;f<C;f++)a+=i[f]*n,i[f]=Math.floor(a%k),a=Math.floor(a/k);g(o,S(1,178,29,210,19,129,64,0)),0<R&&g(o,y(R)),e=x(o,8),t[3]=255&e,e=x(o,8),t[2]=255&e,e=x(o,8),t[1]=255&e,e=x(o,8),t[0]=255&e,e=x(o,8),t[5]=255&e,e=x(o,8),t[4]=255&e,e=x(o,8),t[7]=255&e,e=x(o,8),t[6]=15&e;var o=I(2,255),s=(t[8]=o[0],t[9]=o[1],I(6,255));for(s[0]|=1,s[0]|=2,h=0;h<6;h++)t[10+h]=s[h]}else if(4===r)for(var u=I(16,255),h=0;h<16;h++)this[h]=u[h];else{if(3!==r&&5!==r)throw new Error("UUID: make: invalid version");var p="",c="object"==typeof arguments[1]&&arguments[1]instanceof M?arguments[1]:(new M).parse(arguments[1]);for(h=0;h<16;h++)p+=String.fromCharCode(c[h]);p+=arguments[2];var d=3===r?E(p):v(D(l(e=p,{ibits:8,obits:32,obigendian:!0}),8*e.length),{ibits:32,ibigendian:!0});for(h=0;h<16;h++)t[h]=d.charCodeAt(h)}return t[6]&=15,t[6]|=r<<4,t[8]&=63,t[8]|=128,t},M.prototype.format=function(r){var t,e;return"z85"===r?t=function(r,t){if(t%4!=0)throw new Error("z85_encode: invalid input length (multiple of 4 expected)");for(var e="",o=0,i=0;o<t;)if(i=256*i+r[o++],o%4==0){for(var n=52200625;1<=n;){var a=Math.floor(i/n)%85;e+=f[a],n/=85}i=0}return e}(this,16):"b16"===r?(e=Array(32),o(this,0,15,!0,e,0),t=e.join("")):void 0!==r&&"std"!==r||(e=new Array(36),o(this,0,3,!1,e,0),e[8]="-",o(this,4,5,!1,e,9),e[13]="-",o(this,6,7,!1,e,14),e[18]="-",o(this,8,9,!1,e,19),e[23]="-",o(this,10,15,!1,e,24),t=e.join("")),t},M.prototype.toString=function(r){return this.format(r)},M.prototype.toJSON=function(){return this.format("std")},M.prototype.parse=function(r,t){if("string"!=typeof r)throw new Error("UUID: parse: invalid argument (type string expected)");if("z85"===t){var e=r;var o=this;var i=e.length;if(i%5!=0)throw new Error("z85_decode: invalid input length (multiple of 5 expected)");void 0===o&&(o=new Array(4*i/5));for(var n=0,a=0,f=0;n<i;){var s=e.charCodeAt(n++)-32;if(s<0||p.length<=s)break;if(f=85*f+p[s],n%5==0){for(var u=16777216;1<=u;)o[a++]=Math.trunc(f/u%256),u/=256;f=0}}}else if("b16"===t)h(r,0,35,this,0);else if(void 0===t||"std"===t){t={nil:"00000000-0000-0000-0000-000000000000","ns:DNS":"6ba7b810-9dad-11d1-80b4-00c04fd430c8","ns:URL":"6ba7b811-9dad-11d1-80b4-00c04fd430c8","ns:OID":"6ba7b812-9dad-11d1-80b4-00c04fd430c8","ns:X500":"6ba7b814-9dad-11d1-80b4-00c04fd430c8"};if(void 0!==t[r])r=t[r];else if(!r.match(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/))throw new Error('UUID: parse: invalid string representation (expected "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")');h(r,0,7,this,0),h(r,9,12,this,4),h(r,14,17,this,6),h(r,19,22,this,8),h(r,24,35,this,10)}return this},M.prototype.export=function(){for(var r=Array(16),t=0;t<16;t++)r[t]=this[t];return r},M.prototype.import=function(r){if(!("object"==typeof r&&r instanceof Array))throw new Error("UUID: import: invalid argument (type Array expected)");if(16!==r.length)throw new Error("UUID: import: invalid argument (Array of length 16 expected)");for(var t=0;t<16;t++){if("number"!=typeof r[t])throw new Error("UUID: import: invalid array element #"+t+" (type Number expected)");if(!isFinite(r[t])||Math.floor(r[t])!==r[t])throw new Error("UUID: import: invalid array element #"+t+" (Number with integer value expected)");if(!(0<=r[t]&&r[t]<=255))throw new Error("UUID: import: invalid array element #"+t+" (Number with integer value in range 0...255 expected)");this[t]=r[t]}return this},M.prototype.compare=function(r){if("object"!=typeof r)throw new Error("UUID: compare: invalid argument (type UUID expected)");if(!(r instanceof M))throw new Error("UUID: compare: invalid argument (type UUID expected)");for(var t=0;t<16;t++){if(this[t]<r[t])return-1;if(this[t]>r[t])return 1}return 0},M.prototype.equal=function(r){return 0===this.compare(r)},M.prototype.fold=function(r){if(void 0===r)throw new Error("UUID: fold: invalid argument (number of fold operations expected)");if(r<1||4<r)throw new Error("UUID: fold: invalid argument (1-4 fold operations expected)");for(var t=16/Math.pow(2,r),e=new Array(t),o=0;o<t;o++){for(var i=0,n=0;o+n<16;n+=t)i^=this[o+n];e[o]=i}return e},M.PCG=r,M});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc