1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 22:33:17 +00:00
musix-oss/node_modules/node-forge/dist/prime.worker.min.js

2 lines
21 KiB
JavaScript
Raw Normal View History

2020-03-03 20:30:50 +00:00
!function(t){function i(o){if(r[o])return r[o].exports;var s=r[o]={i:o,l:!1,exports:{}};return t[o].call(s.exports,s,s.exports,i),s.l=!0,s.exports}var r={};i.m=t,i.c=r,i.d=function(t,r,o){i.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:o})},i.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(r,"a",r),r},i.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},i.p="",i(i.s=1)}([function(t,i){t.exports={options:{usePureJavaScript:!1}}},function(t,i,r){r(2),t.exports=r(0)},function(t,i,r){function o(t){for(var i=new p(t.hex,16),r=0,o=t.workLoad,a=0;a<o;++a){if(s(i))return{found:!0,prime:i.toString(16)};i.dAddOffset(d[r++%8],0)}return{found:!1}}function s(t){for(var i=1;i<u.length;){for(var r=u[i],o=i+1;o<u.length&&r<f;)r*=u[o++];for(r=t.modInt(r);i<o;)if(r%u[i++]==0)return!1}return a(t)}function a(t){var i=t.subtract(p.ONE),r=i.getLowestSetBit();if(r<=0)return!1;for(var o,s=i.shiftRight(r),a=n(t.bitLength()),h=e(),u=0;u<a;++u){do{o=new p(t.bitLength(),h)}while(o.compareTo(p.ONE)<=0||o.compareTo(i)>=0);var f=o.modPow(s,t);if(0!==f.compareTo(p.ONE)&&0!==f.compareTo(i)){for(var d=r;--d;){if(f=f.modPowInt(2,t),0===f.compareTo(p.ONE))return!1;if(0===f.compareTo(i))break}if(0===d)return!1}}return!0}function e(){return{nextBytes:function(t){for(var i=0;i<t.length;++i)t[i]=Math.floor(255*Math.random())}}}function n(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}var h=r(0);r(3);var u=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],f=(1<<26)/u[u.length-1],p=h.jsbn.BigInteger;new p(null).fromInt(2),self.addEventListener("message",function(t){var i=o(t.data);self.postMessage(i)}),self.postMessage({found:!1});var d=[6,4,2,4,2,4,6,2]},function(t,i,r){function o(t,i,r){this.data=[],null!=t&&("number"==typeof t?this.fromNumber(t,i,r):null==i&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,i))}function s(){return new o(null)}function a(t,i,r,o,s,a){for(;--a>=0;){var e=i*this.data[t++]+r.data[o]+s;s=Math.floor(e/67108864),r.data[o++]=67108863&e}return s}function e(t,i,r,o,s,a){for(var e=32767&i,n=i>>15;--a>=0;){var h=32767&this.data[t],u=this.data[t++]>>15,f=n*h+u*e;h=e*h+((32767&f)<<15)+r.data[o]+(1073741823&s),s=(h>>>30)+(f>>>15)+n*u+(s>>>30),r.data[o++]=1073741823&h}return s}function n(t,i,r,o,s,a){for(var e=16383&i,n=i>>14;--a>=0;){var h=16383&this.data[t],u=this.data[t++]>>14,f=n*h+u*e;h=e*h+((16383&f)<<14)+r.data[o]+s,s=(h>>28)+(f>>14)+n*u,r.data[o++]=268435455&h}return s}function h(t){return ai.charAt(t)}function u(t,i){var r=ei[t.charCodeAt(i)];return null==r?-1:r}function f(t){for(var i=this.t-1;i>=0;--i)t.data[i]=this.data[i];t.t=this.t,t.s=this.s}function p(t){this.t=1,this.s=t<0?-1:0,t>0?this.data[0]=t:t<-1?this.data[0]=t+this.DV:this.t=0}function d(t){var i=s();return i.fromInt(t),i}function c(t,i){var r;if(16==i)r=4;else if(8==i)r=3;else if(256==i)r=8;else if(2==i)r=1;else if(32==i)r=5;else{if(4!=i)return void this.fromRadix(t,i);r=2}this.t=0,this.s=0;for(var s=t.length,a=!1,e=0;--s>=0;){var n=8==r?255&t[s]:u(t,s);n<0?"-"==t.charAt(s)&&(a=!0):(a=!1,0==e?this.data[this.t++]=n:e+r>this.DB?(this.data[this.t-1]|=(n&(1<<this.DB-e)-1)<<e,this.data[this.t++]=n>>this.DB-e):this.data[this.t-1]|=n<<e,(e+=r)>=this.DB&&(e-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,e>0&&(this.data[this.t-1]|=(1<<this.DB-e)-1<<e)),this.clamp(),a&&o.ZERO.subTo(this,this)}function m(){for(var t=this.s&this.DM;this
//# sourceMappingURL=prime.worker.min.js.map