You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vaultwarden/web-vault/lib/forge/prime.worker.min.js

2 lines
21 KiB

!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={};return i.m=t,i.c=r,i.i=function(t){return t},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=3)}([function(t,i){t.exports={options:{usePureJavaScript:!1}}},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(c[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(2);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,d=new p(null);d.fromInt(2),self.addEventListener("message",function(t){var i=o(t.data);self.postMessage(i)}),self.postMessage({found:!1});var c=[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 hi.charAt(t)}function u(t,i){var r=ui[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,e>=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.t>0&&this.data[this.t-1]==t;)--this.t}function l(t){if(this.s<0)return"-"+this.negate().toString(t);var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return this.toRadix(t);i=2}var r,o=(1<<i)-1,s=!1,a="",e=this.t,n=this.DB-e*this.DB%i;if(e-- >0)for(n<this.DB&&(r=this.data[e]>>n)>0&&(s=!0,a=h(r));e>=0;)n<i?(r=(this.data[e]&(1<<n)-1)<<i-n,r|=this.data[--e]>>(n+=this.DB-i)):(r=this.data[e]>>(n-=i)&o,n<=0&&(n+=this.DB,--e)),r>0&&(s=!0),s&&(a+=h(r));return s?a:"0"}function v(){var t=s();return o.ZERO.subTo(this,t),t}function T(){return this.s<0?this.negate():this}function y(t){var i=this.s-t.s;if(0!=i)return i;var r=this.t;if(i=r-t.t,0!=i)return this.s<0?-i:i;for(;--r>=0;)if(0!=(i=this.data[r]-t.data[r]))return i;return 0}function b(t){var i,r=1;return 0!=(i=t>>>16)&&(t=i,r+=16),0!=(i=t>>8)&&(t=i,r+=8),0!=(i=t>>4)&&(t=i,r+=4),0!=(i=t>>2)&&(t=i,r+=2),0!=(i=t>>1)&&(t=i,r+=1),r}function D(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function g(t,i){var r;for(r=this.t-1;r>=0;--r)i.data[r+t]=this.data[r];for(r=t-1;r>=0;--r)i.data[r]=0;i.t=this.t+t,i.s=this.s}function B(t,i){for(var r=t;r<this.t;++r)i.data[r-t]=this.data[r];i.t=Math.max(this.t-t,0),i.s=this.s}function S(t,i){var r,o=t%this.DB,s=this.DB-o,a=(1<<s)-1,e=Math.floor(t/this.DB),n=this.s<<o&this.DM;for(r=this.t-1;r>=0;--r)i.data[r+e+1]=this.data[r]>>s|n,n=(this.data[r]&a)<<o;for(r=e-1;r>=0;--r)i.data[r]=0;i.data[e]=n,i.t=this.t+e+1,i.s=this.s,i.clamp()}function w(t,i){i.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)return void(i.t=0);var o=t%this.DB,s=this.DB-o,a=(1<<o)-1;i.data[0]=this.data[r]>>o;for(var e=r+1;e<this.t;++e)i.data[e-r-1]|=(this.data[e]&a)<<s,i.data[e-r]=this.data[e]>>o;o>0&&(i.data[this.t-r-1]|=(this.s&a)<<s),i.t=this.t-r,i.clamp()}function M(t,i){for(var r=0,o=0,s=Math.min(t.t,this.t);r<s;)o+=this.data[r]-t.data[r],i.data[r++]=o&this.DM,o>>=this.DB;if(t.t<this.t){for(o-=t.s;r<this.t;)o+=this.data[r],i.data[r++]=o&this.DM,o>>=this.DB;o+=this.s}else{for(o+=this.s;r<t.t;)o-=t.data[r],i.data[r++]=o&this.DM,o>>=this.DB;o-=t.s}i.s=o<0?-1:0,o<-1?i.data[r++]=this.DV+o:o>0&&(i.data[r++]=o),i.t=r,i.clamp()}function E(t,i){var r=this.abs(),s=t.abs(),a=r.t;for(i.t=a+s.t;--a>=0;)i.data[a]=0;for(a=0;a<s.t;++a)i.data[a+r.t]=r.am(0,s.data[a],i,a,0,r.t);i.s=0,i.clamp(),this.s!=t.s&&o.ZERO.subTo(i,i)}function O(t){for(var i=this.abs(),r=t.t=2*i.t;--r>=0;)t.data[r]=0;for(r=0;r<i.t-1;++r){var o=i.am(r,i.data[r],t,2*r,0,1);(t.data[r+i.t]+=i.am(r+1,2*i.data[r],t,2*r+1,o,i.t-r-1))>=i.DV&&(t.data[r+i.t]-=i.DV,t.data[r+i.t+1]=1)}t.t>0&&(t.data[t.t-1]+=i.am(r,i.data[r],t,2*r,0,1)),t.s=0,t.clamp()}function R(t,i,r){var a=t.abs();if(!(a.t<=0)){var e=this.abs();if(e.t<a.t)return null!=i&&i.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=s());var n=s(),h=this.s,u=t.s,f=this.DB-b(a.data[a.t-1]);f>0?(a.lShiftTo(f,n),e.lShiftTo(f,r)):(a.copyTo(n),e.copyTo(r));var p=n.t,d=n.data[p-1];if(0!=d){var c=d*(1<<this.F1)+(p>1?n.data[p-2]>>this.F2:0),m=this.FV/c,l=(1<<this.F1)/c,v=1<<this.F2,T=r.t,y=T-p,D=null==i?s():i;for(n.dlShiftTo(y,D),r.compareTo(D)>=0&&(r.data[r.t++]=1,r.subTo(D,r)),o.ONE.dlShiftTo(p,D),D.subTo(n,n);n.t<p;)n.data[n.t++]=0;for(;--y>=0;){var g=r.data[--T]==d?this.DM:Math.floor(r.data[T]*m+(r.data[T-1]+v)*l);if((r.data[T]+=n.am(0,g,r,y,0,p))<g)for(n.dlShiftTo(y,D),r.subTo(D,r);r.data[T]<--g;)r.subTo(D,r)}null!=i&&(r.drShiftTo(p,i),h!=u&&o.ZERO.subTo(i,i)),r.t=p,r.clamp(),f>0&&r.rShiftTo(f,r),h<0&&o.ZERO.subTo(r,r)}}}function x(t){var i=s();return this.abs().divRemTo(t,null,i),this.s<0&&i.compareTo(o.ZERO)>0&&t.subTo(i,i),i}function N(t){this.m=t}function A(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function L(t){return t}function V(t){t.divRemTo(this.m,null,t)}function q(t,i,r){t.multiplyTo(i,r),this.reduce(r)}function I(t,i){t.squareTo(i),this.reduce(i)}function P(){if(this.t<1)return 0;var t=this.data[0];if(0==(1&t))return 0;var i=3&t;return i=i*(2-(15&t)*i)&15,i=i*(2-(255&t)*i)&255,i=i*(2-((65535&t)*i&65535))&65535,i=i*(2-t*i%this.DV)%this.DV,i>0?this.DV-i:-i}function Z(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function F(t){var i=s();return t.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),t.s<0&&i.compareTo(o.ZERO)>0&&this.m.subTo(i,i),i}function j(t){var i=s();return t.copyTo(i),this.reduce(i),i}function k(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var i=0;i<this.m.t;++i){var r=32767&t.data[i],o=r*this.mpl+((r*this.mph+(t.data[i]>>15)*this.mpl&this.um)<<15)&t.DM;for(r=i+this.m.t,t.data[r]+=this.m.am(0,o,t,i,0,this.m.t);t.data[r]>=t.DV;)t.data[r]-=t.DV,t.data[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function C(t,i){t.squareTo(i),this.reduce(i)}function z(t,i,r){t.multiplyTo(i,r),this.reduce(r)}function U(){return 0==(this.t>0?1&this.data[0]:this.s)}function _(t,i){if(t>4294967295||t<1)return o.ONE;var r=s(),a=s(),e=i.convert(this),n=b(t)-1;for(e.copyTo(r);--n>=0;)if(i.sqrTo(r,a),(t&1<<n)>0)i.mulTo(a,e,r);else{var h=r;r=a,a=h}return i.revert(r)}function J(t,i){var r;return r=t<256||i.isEven()?new N(i):new Z(i),this.exp(t,r)}function G(){var t=s();return this.copyTo(t),t}function H(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function K(){return 0==this.t?this.s:this.data[0]<<24>>24}function Q(){return 0==this.t?this.s:this.data[0]<<16>>16}function W(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function X(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1}function Y(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var i=this.chunkSize(t),r=Math.pow(t,i),o=d(r),a=s(),e=s(),n="";for(this.divRemTo(o,a,e);a.signum()>0;)n=(r+e.intValue()).toString(t).substr(1)+n,a.divRemTo(o,a,e);return e.intValue().toString(t)+n}function $(t,i){this.fromInt(0),null==i&&(i=10);for(var r=this.chunkSize(i),s=Math.pow(i,r),a=!1,e=0,n=0,h=0;h<t.length;++h){var f=u(t,h);f<0?"-"==t.charAt(h)&&0==this.signum()&&(a=!0):(n=i*n+f,++e>=r&&(this.dMultiply(s),this.dAddOffset(n,0),e=0,n=0))}e>0&&(this.dMultiply(Math.pow(i,e)),this.dAddOffset(n,0)),a&&o.ZERO.subTo(this,this)}function tt(t,i,r){if("number"==typeof i)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(o.ONE.shiftLeft(t-1),ht,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(o.ONE.shiftLeft(t-1),this);else{var s=new Array,a=7&t;s.length=(t>>3)+1,i.nextBytes(s),a>0?s[0]&=(1<<a)-1:s[0]=0,this.fromString(s,256)}}function it(){var t=this.t,i=new Array;i[0]=this.s;var r,o=this.DB-t*this.DB%8,s=0;if(t-- >0)for(o<this.DB&&(r=this.data[t]>>o)!=(this.s&this.DM)>>o&&(i[s++]=r|this.s<<this.DB-o);t>=0;)o<8?(r=(this.data[t]&(1<<o)-1)<<8-o,r|=this.data[--t]>>(o+=this.DB-8)):(r=this.data[t]>>(o-=8)&255,o<=0&&(o+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==s&&(128&this.s)!=(128&r)&&++s,(s>0||r!=this.s)&&(i[s++]=r);return i}function rt(t){return 0==this.compareTo(t)}function ot(t){return this.compareTo(t)<0?this:t}function st(t){return this.compareTo(t)>0?this:t}function at(t,i,r){var o,s,a=Math.min(t.t,this.t);for(o=0;o<a;++o)r.data[o]=i(this.data[o],t.data[o]);if(t.t<this.t){for(s=t.s&this.DM,o=a;o<this.t;++o)r.data[o]=i(this.data[o],s);r.t=this.t}else{for(s=this.s&this.DM,o=a;o<t.t;++o)r.data[o]=i(s,t.data[o]);r.t=t.t}r.s=i(this.s,t.s),r.clamp()}function et(t,i){return t&i}function nt(t){var i=s();return this.bitwiseTo(t,et,i),i}function ht(t,i){return t|i}function ut(t){var i=s();return this.bitwiseTo(t,ht,i),i}function ft(t,i){return t^i}function pt(t){var i=s();return this.bitwiseTo(t,ft,i),i}function dt(t,i){return t&~i}function ct(t){var i=s();return this.bitwiseTo(t,dt,i),i}function mt(){for(var t=s(),i=0;i<this.t;++i)t.data[i]=this.DM&~this.data[i];return t.t=this.t,t.s=~this.s,t}function lt(t){var i=s();return t<0?this.rShiftTo(-t,i):this.lShiftTo(t,i),i}function vt(t){var i=s();return t<0?this.lShiftTo(-t,i):this.rShiftTo(t,i),i}function Tt(t){if(0==t)return-1;var i=0;return 0==(65535&t)&&(t>>=16,i+=16),0==(255&t)&&(t>>=8,i+=8),0==(15&t)&&(t>>=4,i+=4),0==(3&t)&&(t>>=2,i+=2),0==(1&t)&&++i,i}function yt(){for(var t=0;t<this.t;++t)if(0!=this.data[t])return t*this.DB+Tt(this.data[t]);return this.s<0?this.t*this.DB:-1}function bt(t){for(var i=0;0!=t;)t&=t-1,++i;return i}function Dt(){for(var t=0,i=this.s&this.DM,r=0;r<this.t;++r)t+=bt(this.data[r]^i);return t}function gt(t){var i=Math.floor(t/this.DB);return i>=this.t?0!=this.s:0!=(this.data[i]&1<<t%this.DB)}function Bt(t,i){var r=o.ONE.shiftLeft(t);return this.bitwiseTo(r,i,r),r}function St(t){return this.changeBit(t,ht)}function wt(t){return this.changeBit(t,dt)}function Mt(t){return this.changeBit(t,ft)}function Et(t,i){for(var r=0,o=0,s=Math.min(t.t,this.t);r<s;)o+=this.data[r]+t.data[r],i.data[r++]=o&this.DM,o>>=this.DB;if(t.t<this.t){for(o+=t.s;r<this.t;)o+=this.data[r],i.data[r++]=o&this.DM,o>>=this.DB;o+=this.s}else{for(o+=this.s;r<t.t;)o+=t.data[r],i.data[r++]=o&this.DM,o>>=this.DB;o+=t.s}i.s=o<0?-1:0,o>0?i.data[r++]=o:o<-1&&(i.data[r++]=this.DV+o),i.t=r,i.clamp()}function Ot(t){var i=s();return this.addTo(t,i),i}function Rt(t){var i=s();return this.subTo(t,i),i}function xt(t){var i=s();return this.multiplyTo(t,i),i}function Nt(t){var i=s();return this.divRemTo(t,i,null),i}function At(t){var i=s();return this.divRemTo(t,null,i),i}function Lt(t){var i=s(),r=s();return this.divRemTo(t,i,r),new Array(i,r)}function Vt(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function qt(t,i){if(0!=t){for(;this.t<=i;)this.data[this.t++]=0;for(this.data[i]+=t;this.data[i]>=this.DV;)this.data[i]-=this.DV,++i>=this.t&&(this.data[this.t++]=0),++this.data[i]}}function It(){}function Pt(t){return t}function Zt(t,i,r){t.multiplyTo(i,r)}function Ft(t,i){t.squareTo(i)}function jt(t){return this.exp(t,new It)}function kt(t,i,r){var o=Math.min(this.t+t.t,i);for(r.s=0,r.t=o;o>0;)r.data[--o]=0;var s;for(s=r.t-this.t;o<s;++o)r.data[o+this.t]=this.am(0,t.data[o],r,o,0,this.t);for(s=Math.min(t.t,i);o<s;++o)this.am(0,t.data[o],r,o,0,i-o);r.clamp()}function Ct(t,i,r){--i;var o=r.t=this.t+t.t-i;for(r.s=0;--o>=0;)r.data[o]=0;for(o=Math.max(i-this.t,0);o<t.t;++o)r.data[this.t+o-i]=this.am(i-o,t.data[o],r,0,0,this.t+o-i);r.clamp(),r.drShiftTo(1,r)}function zt(t){this.r2=s(),this.q3=s(),o.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function Ut(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var i=s();return t.copyTo(i),this.reduce(i),i}function _t(t){return t}function Jt(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function Gt(t,i){t.squareTo(i),this.reduce(i)}function Ht(t,i,r){t.multiplyTo(i,r),this.reduce(r)}function Kt(t,i){var r,o,a=t.bitLength(),e=d(1);if(a<=0)return e;r=a<18?1:a<48?3:a<144?4:a<768?5:6,o=a<8?new N(i):i.isEven()?new zt(i):new Z(i);var n=new Array,h=3,u=r-1,f=(1<<r)-1;if(n[1]=o.convert(this),r>1){var p=s();for(o.sqrTo(n[1],p);h<=f;)n[h]=s(),o.mulTo(p,n[h-2],n[h]),h+=2}var c,m,l=t.t-1,v=!0,T=s();for(a=b(t.data[l])-1;l>=0;){for(a>=u?c=t.data[l]>>a-u&f:(c=(t.data[l]&(1<<a+1)-1)<<u-a,l>0&&(c|=t.data[l-1]>>this.DB+a-u)),h=r;0==(1&c);)c>>=1,--h;if((a-=h)<0&&(a+=this.DB,--l),v)n[c].copyTo(e),v=!1;else{for(;h>1;)o.sqrTo(e,T),o.sqrTo(T,e),h-=2;h>0?o.sqrTo(e,T):(m=e,e=T,T=m),o.mulTo(T,n[c],e)}for(;l>=0&&0==(t.data[l]&1<<a);)o.sqrTo(e,T),m=e,e=T,T=m,--a<0&&(a=this.DB-1,--l)}return o.revert(e)}function Qt(t){var i=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(i.compareTo(r)<0){var o=i;i=r,r=o}var s=i.getLowestSetBit(),a=r.getLowestSetBit();if(a<0)return i;for(s<a&&(a=s),a>0&&(i.rShiftTo(a,i),r.rShiftTo(a,r));i.signum()>0;)(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),(s=r.getLowestSetBit())>0&&r.rShiftTo(s,r),i.compareTo(r)>=0?(i.subTo(r,i),i.rShiftTo(1,i)):(r.subTo(i,r),r.rShiftTo(1,r));return a>0&&r.lShiftTo(a,r),r}function Wt(t){if(t<=0)return 0;var i=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==i)r=this.data[0]%t;else for(var o=this.t-1;o>=0;--o)r=(i*r+this.data[o])%t;return r}function Xt(t){var i=t.isEven();if(this.isEven()&&i||0==t.signum())return o.ZERO;for(var r=t.clone(),s=this.clone(),a=d(1),e=d(0),n=d(0),h=d(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),i?(a.isEven()&&e.isEven()||(a.addTo(this,a),e.subTo(t,e)),a.rShiftTo(1,a)):e.isEven()||e.subTo(t,e),e.rShiftTo(1,e);for(;s.isEven();)s.rShiftTo(1,s),i?(n.isEven()&&h.isEven()||(n.addTo(this,n),h.subTo(t,h)),n.rShiftTo(1,n)):h.isEven()||h.subTo(t,h),h.rShiftTo(1,h);r.compareTo(s)>=0?(r.subTo(s,r),i&&a.subTo(n,a),e.subTo(h,e)):(s.subTo(r,s),i&&n.subTo(a,n),h.subTo(e,h))}return 0!=s.compareTo(o.ONE)?o.ZERO:h.compareTo(t)>=0?h.subtract(t):h.signum()<0?(h.addTo(t,h),h.signum()<0?h.add(t):h):h}function Yt(t){var i,r=this.abs();if(1==r.t&&r.data[0]<=fi[fi.length-1]){for(i=0;i<fi.length;++i)if(r.data[0]==fi[i])return!0;return!1}if(r.isEven())return!1;for(i=1;i<fi.length;){for(var o=fi[i],s=i+1;s<fi.length&&o<pi;)o*=fi[s++];for(o=r.modInt(o);i<s;)if(o%fi[i++]==0)return!1}return r.millerRabin(t)}function $t(t){var i=this.subtract(o.ONE),r=i.getLowestSetBit();if(r<=0)return!1;for(var s,a=i.shiftRight(r),e=ti(),n=0;n<t;++n){do s=new o(this.bitLength(),e);while(s.compareTo(o.ONE)<=0||s.compareTo(i)>=0);var h=s.modPow(a,this);if(0!=h.compareTo(o.ONE)&&0!=h.compareTo(i)){for(var u=1;u++<r&&0!=h.compareTo(i);)if(h=h.modPowInt(2,this),0==h.compareTo(o.ONE))return!1;if(0!=h.compareTo(i))return!1}}return!0}function ti(){return{nextBytes:function(t){for(var i=0;i<t.length;++i)t[i]=Math.floor(256*Math.random())}}}var ii=r(0);t.exports=ii.jsbn=ii.jsbn||{};var ri,oi=0xdeadbeefcafe,si=15715070==(16777215&oi);ii.jsbn.BigInteger=o,"undefined"==typeof navigator?(o.prototype.am=n,ri=28):si&&"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=e,ri=30):si&&"Netscape"!=navigator.appName?(o.prototype.am=a,ri=26):(o.prototype.am=n,ri=28),o.prototype.DB=ri,o.prototype.DM=(1<<ri)-1,o.prototype.DV=1<<ri;var ai=52;o.prototype.FV=Math.pow(2,ai),o.prototype.F1=ai-ri,o.prototype.F2=2*ri-ai;var ei,ni,hi="0123456789abcdefghijklmnopqrstuvwxyz",ui=new Array;for(ei="0".charCodeAt(0),ni=0;ni<=9;++ni)ui[ei++]=ni;for(ei="a".charCodeAt(0),ni=10;ni<36;++ni)ui[ei++]=ni;for(ei="A".charCodeAt(0),ni=10;ni<36;++ni)ui[ei++]=ni;N.prototype.convert=A,N.prototype.revert=L,N.prototype.reduce=V,N.prototype.mulTo=q,N.prototype.sqrTo=I,Z.prototype.convert=F,Z.prototype.revert=j,Z.prototype.reduce=k,Z.prototype.mulTo=z,Z.prototype.sqrTo=C,o.prototype.copyTo=f,o.prototype.fromInt=p,o.prototype.fromString=c,o.prototype.clamp=m,o.prototype.dlShiftTo=g,o.prototype.drShiftTo=B,o.prototype.lShiftTo=S,o.prototype.rShiftTo=w,o.prototype.subTo=M,o.prototype.multiplyTo=E,o.prototype.squareTo=O,o.prototype.divRemTo=R,o.prototype.invDigit=P,o.prototype.isEven=U,o.prototype.exp=_,o.prototype.toString=l,o.prototype.negate=v,o.prototype.abs=T,o.prototype.compareTo=y,o.prototype.bitLength=D,o.prototype.mod=x,o.prototype.modPowInt=J,o.ZERO=d(0),o.ONE=d(1),It.prototype.convert=Pt,It.prototype.revert=Pt,It.prototype.mulTo=Zt,It.prototype.sqrTo=Ft,zt.prototype.convert=Ut,zt.prototype.revert=_t,zt.prototype.reduce=Jt,zt.prototype.mulTo=Ht,zt.prototype.sqrTo=Gt;var fi=[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],pi=(1<<26)/fi[fi.length-1];o.prototype.chunkSize=W,o.prototype.toRadix=Y,o.prototype.fromRadix=$,o.prototype.fromNumber=tt,o.prototype.bitwiseTo=at,o.prototype.changeBit=Bt,o.prototype.addTo=Et,o.prototype.dMultiply=Vt,o.prototype.dAddOffset=qt,o.prototype.multiplyLowerTo=kt,o.prototype.multiplyUpperTo=Ct,o.prototype.modInt=Wt,o.prototype.millerRabin=$t,o.prototype.clone=G,o.prototype.intValue=H,o.prototype.byteValue=K,o.prototype.shortValue=Q,o.prototype.signum=X,o.prototype.toByteArray=it,o.prototype.equals=rt,o.prototype.min=ot,o.prototype.max=st,o.prototype.and=nt,o.prototype.or=ut,o.prototype.xor=pt,o.prototype.andNot=ct,o.prototype.not=mt,o.prototype.shiftLeft=lt,o.prototype.shiftRight=vt,o.prototype.getLowestSetBit=yt,o.prototype.bitCount=Dt,o.prototype.testBit=gt,o.prototype.setBit=St,o.prototype.clearBit=wt,o.prototype.flipBit=Mt,o.prototype.add=Ot,o.prototype.subtract=Rt,o.prototype.multiply=xt,o.prototype.divide=Nt,o.prototype.remainder=At,o.prototype.divideAndRemainder=Lt,o.prototype.modPow=Kt,o.prototype.modInverse=Xt,o.prototype.pow=jt,o.prototype.gcd=Qt,o.prototype.isProbablePrime=Yt},function(t,i,r){r(1),t.exports=r(0)}]);
//# sourceMappingURL=prime.worker.min.js.map