| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632 |
- /********************************************/
- /* */
- /* Copyright (c) 2020 Aostar */
- /* @author bgu */
- /* @version 2.9 */
- /* */
- /********************************************/
- function K(src, ei, ed, eo, dm) {
- var gX = dm;
- if (ei + dm > src.length && eo + dm <= ed.length) {
- gX = src.length - ei;
- } else if (eo + dm > ed.length && ei + dm <= src.length) {
- gX = ed.length - eo;
- } else if (ei + dm <= src.length && eo + dm <= ed.length) {
- gX = dm;
- } else if (ed.length < src.length) {
- gX = ed.length - eo;
- } else {
- gX = src.length - eo;
- }
- for (var i = 0; i < gX; i++) {
- ed[i + eo] = src[i + ei];
- }
- };
- function co(jr, ei, ij, eo, dm) {
- if (jr.length - ei < dm) {
- return -1;
- }
- if (ij.length - eo < dm) {
- return -1;
- }
- for (var i = 0; i < dm; i++) {
- if (jr[ei++] != ij[eo++]) {
- return -1;
- }
- }
- return 0;
- };
- function F(hA) {
- return new Array((hA >> 24) & 0x000000FF, (hA >> 16) & 0x000000FF, (hA >> 8) & 0x000000FF, (hA) & 0x000000FF);
- };
- function ap(gL) {
- var b = new Array(gL.length * 4);
- for (var i = 0; i < gL.length; i++) {
- K(F(gL[i]), 0, b, i * 4, 4);
- }
- return b;
- };
- function bB(b, pos) {
- if (pos + 3 < b.length) {
- return ((b[pos]) << 24) | ((b[pos + 1]) << 16) | ((b[pos + 2]) << 8) | ((b[pos + 3]));
- } else if (pos + 2 < b.length) {
- return ((b[pos + 1]) << 16) | ((b[pos + 2]) << 8) | ((b[pos + 3]));
- } else if (pos + 1 < b.length) {
- return ((b[pos]) << 8) | ((b[pos + 1]));
- } else {
- return ((b[pos]));
- }
- };
- function aI(b) {
- var kF = Math.ceil(b.length / 4);
- var out = new Array(kF);
- for (var i = 0; i < b.length; i++) {
- b[i] = b[i] & 0xFF;
- }
- for (var i = 0; i < out.length; i++) {
- out[i] = bB(b, i * 4);
- }
- return out;
- };
- var CommonUtils = {
- bytesToHex: function (ev) {
- var dm = ev.length;
- var dg = new Array(dm * 2);
- var ju = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
- for (var i = 0, j = 0; i < dm; i++, j++) {
- dg[j] = ju[(ev[i] & 0xFF) >> 4];
- dg[++j] = ju[(ev[i] & 0x0F)];
- }
- return dg.join('');
- },
- hexToBytes: function (hC) {
- if (hC == null || hC == '') {
- return null;
- }
- if (hC.length % 2 != 0) {
- return null;
- }
- var il = hC.length / 2;
- var dg = this.jY(hC);
- var eG = new Array(il);
- for (var i = 0; i < il; i++) {
- if (dg[2 * i] >= 0x30 && dg[2 * i] <= 0x39) {
- eG[i] = ((dg[2 * i] - 0x30) << 4);
- } else if (dg[2 * i] >= 0x41 && dg[2 * i] <= 0x46) {
- eG[i] = ((dg[2 * i] - 0x41 + 10) << 4);
- } else if (dg[2 * i] >= 0x61 && dg[2 * i] <= 0x66) {
- eG[i] = ((dg[2 * i] - 0x61 + 10) << 4);
- } else {
- return null;
- }
- if (dg[2 * i + 1] >= 0x30 && dg[2 * i + 1] <= 0x39) {
- eG[i] = (eG[i] | (dg[2 * i + 1] - 0x30));
- } else if (dg[2 * i + 1] >= 0x41 && dg[2 * i + 1] <= 0x46) {
- eG[i] = (eG[i] | (dg[2 * i + 1] - 0x41 + 10));
- } else if (dg[2 * i + 1] >= 0x61 && dg[2 * i + 1] <= 0x66) {
- eG[i] = (eG[i] | (dg[2 * i + 1] - 0x61 + 10));
- } else {
- return null;
- }
- }
- return eG;
- },
- utf8StrToHex: function (fT) {
- var iG = encodeURIComponent(fT);
- var gA = unescape(iG);
- var iY = gA.length;
- var eN = [];
- for (var i = 0; i < iY; i++) {
- eN[i] = (gA.charCodeAt(i).toString(16)).toUpperCase();
- }
- return eN.join('');
- },
- utf8StrToBytes: function (fT) {
- var iG = encodeURIComponent(fT);
- var gA = unescape(iG);
- var iY = gA.length;
- var eN = [];
- for (var i = 0; i < iY; i++) {
- eN[i] = gA.charCodeAt(i);
- }
- return eN;
- },
- hexToUtf8Str: function (fT) {
- var gn = CommonUtils.hexToBytes(fT);
- var gE = [];
- for (var i = 0; i < gn.length; i++) {
- gE.push(String.fromCharCode(gn[i]));
- }
- return decodeURIComponent(escape(gE.join('')));
- },
- bytesToUtf8Str: function (kt) {
- var gn = kt;
- var gE = [];
- for (var i = 0; i < gn.length; i++) {
- gE.push(String.fromCharCode(gn[i]));
- }
- return decodeURIComponent(escape(gE.join('')));
- },
- jY: function (hN) {
- var iW = new Array(hN.length);
- for (var i = 0; i < hN.length; i++) {
- iW[i] = hN.charCodeAt(i);
- }
- return iW;
- },
- isHexString: function (fL) {
- var pattern = new RegExp(/^[A-Za-z0-9]+$/);
- return fL != null && pattern.test(fL);
- },
- randomWord: function (dm) {
- var fL = "";
- var hF = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
- 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E',
- 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
- '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_'
- ];
- for (var i = 0; i < dm; i++) {
- pos = Math.round(Math.random() * (hF.length - 1));
- fL += hF[pos];
- }
- return fL;
- },
- randomHex: function (dm) {
- var fL = "";
- var hF = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
- for (var i = 0; i < dm; i++) {
- pos = Math.round(Math.random() * (hF.length - 1));
- fL += hF[pos];
- }
- return fL;
- },
- equals: function (eH, fv) {
- for (fK in eH) {
- if (eH.hasOwnProperty(fK) != fv.hasOwnProperty(fK)) {
- return false;
- } else if (typeof eH[fK] != typeof fv[fK]) {
- return false;
- }
- }
- for (fK in fv) {
- if (eH.hasOwnProperty(fK) != fv.hasOwnProperty(fK)) {
- return false;
- } else if (typeof eH[fK] != typeof fv[fK]) {
- return false;
- }
- if (!eH.hasOwnProperty(fK)) continue;
- if (eH[fK] instanceof Array && fv[fK] instanceof Array) {
- if (!eH[fK].equals(fv[fK])) return false;
- } else if (eH[fK] instanceof Object && fv[fK] instanceof Object) {
- if (!eH[fK].equals(fv[fK])) return false;
- } else if (eH[fK] != fv[fK]) {
- return false;
- }
- }
- return true;
- },
- v_ltd: function () {
- var word = new jW.mG.mP.gD([-442786843, -1214389064, -1377332043, -443502618, -1735465320, -1612398687, -
- 427708442, -1971263844, -1343841143, -375811867, -2052266609, -1207959552
- ]);
- var text = word.toString(jW.ey.nj);
- return text;
- }
- };
- var ep;
- var kK = 0xdeadbeefcafe;
- var iL = ((kK & 0xffffff) == 0xefcafe);
- function L(a, b, c) {
- if (a != null)
- if ("number" == typeof a) this.iM(a, b, c);
- else if (b == null && "string" != typeof a) this.hK(a, 256);
- else this.hK(a, b);
- };
- function C() {
- return new L(null);
- };
- function al(i, x, w, j, c, n) {
- while (--n >= 0) {
- var v = x * this[i++] + w[j] + c;
- c = Math.floor(v / 0x4000000);
- w[j++] = v & 0x3ffffff;
- }
- return c;
- };
- function bD(i, x, w, j, c, n) {
- var gw = x & 0x7fff,
- gl = x >> 15;
- while (--n >= 0) {
- var l = this[i] & 0x7fff;
- var h = this[i++] >> 15;
- var m = gl * l + h * gw;
- l = gw * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);
- c = (l >>> 30) + (m >>> 15) + gl * h + (c >>> 30);
- w[j++] = l & 0x3fffffff;
- }
- return c;
- };
- function dK(i, x, w, j, c, n) {
- var gw = x & 0x3fff,
- gl = x >> 14;
- while (--n >= 0) {
- var l = this[i] & 0x3fff;
- var h = this[i++] >> 14;
- var m = gl * l + h * gw;
- l = gw * l + ((m & 0x3fff) << 14) + w[j] + c;
- c = (l >> 28) + (m >> 14) + gl * h;
- w[j++] = l & 0xfffffff;
- }
- return c;
- };
- if (iL && (navigator.appName == "Microsoft Internet Explorer")) {
- L.prototype.eZ = bD;
- ep = 30;
- } else if (iL && (navigator.appName != "Netscape")) {
- L.prototype.eZ = al;
- ep = 26;
- } else {
- L.prototype.eZ = dK;
- ep = 28;
- }
- L.prototype.ct = ep;
- L.prototype.fi = ((1 << ep) - 1);
- L.prototype.ez = (1 << ep);
- var im = 52;
- L.prototype.ku = Math.pow(2, im);
- L.prototype.iR = im - ep;
- L.prototype.io = 2 * ep - im;
- var jV = "0123456789abcdefghijklmnopqrstuvwxyz";
- var gQ = new Array();
- var gr = "0".charCodeAt(0);
- for (var ej = 0; ej <= 9; ++ej) gQ[gr++] = ej;
- gr = "a".charCodeAt(0);
- for (var ej = 10; ej < 36; ++ej) gQ[gr++] = ej;
- gr = "A".charCodeAt(0);
- for (var ej = 10; ej < 36; ++ej) gQ[gr++] = ej;
- function bk(n) {
- return jV.charAt(n);
- };
- function bw(s, i) {
- var c = gQ[s.charCodeAt(i)];
- return (c == null) ? -1 : c;
- };
- function dQ(r) {
- for (var i = this.t - 1; i >= 0; --i) r[i] = this[i];
- r.t = this.t;
- r.s = this.s;
- };
- function cS(x) {
- this.t = 1;
- this.s = (x < 0) ? -1 : 0;
- if (x > 0) this[0] = x;
- else if (x < -1) this[0] = x + this.ez;
- else this.t = 0;
- };
- function H(i) {
- var r = C();
- r.eT(i);
- return r;
- };
- function dc(s, b) {
- var k;
- if (b == 16) k = 4;
- else if (b == 8) k = 3;
- else if (b == 256) k = 8;
- else if (b == 2) k = 1;
- else if (b == 32) k = 5;
- else if (b == 4) k = 2;
- else {
- this.jP(s, b);
- return;
- }
- this.t = 0;
- this.s = 0;
- var i = s.length,
- gO = false,
- fr = 0;
- while (--i >= 0) {
- var x = (k == 8) ? s[i] & 0xff : bw(s, i);
- if (x < 0) {
- if (s.charAt(i) == "-") gO = true;
- continue;
- }
- gO = false;
- if (fr == 0) this[this.t++] = x;
- else if (fr + k > this.ct) {
- this[this.t - 1] |= (x & ((1 << (this.ct - fr)) - 1)) << fr;
- this[this.t++] = (x >> (this.ct - fr));
- } else this[this.t - 1] |= x << fr;
- fr += k;
- if (fr >= this.ct) fr -= this.ct;
- }
- if (k == 8 && (s[0] & 0x80) != 0) {
- this.s = -1;
- if (fr > 0) this[this.t - 1] |= ((1 << (this.ct - fr)) - 1) << fr;
- }
- this.ff();
- if (gO) L.ZERO.cp(this, this);
- };
- function cf() {
- var c = this.s & this.fi;
- while (this.t > 0 && this[this.t - 1] == c) --this.t;
- };
- function aH(b) {
- if (this.s < 0) return "-" + this.el().toString(b);
- var k;
- if (b == 16) k = 4;
- else if (b == 8) k = 3;
- else if (b == 2) k = 1;
- else if (b == 32) k = 5;
- else if (b == 4) k = 2;
- else return this.eD(b);
- var hx = (1 << k) - 1,
- d, m = false,
- r = "",
- i = this.t;
- var p = this.ct - (i * this.ct) % k;
- if (i-- > 0) {
- if (p < this.ct && (d = this[i] >> p) > 0) {
- m = true;
- r = bk(d);
- }
- while (i >= 0) {
- if (p < k) {
- d = (this[i] & ((1 << p) - 1)) << (k - p);
- d |= this[--i] >> (p += this.ct - k);
- } else {
- d = (this[i] >> (p -= k)) & hx;
- if (p <= 0) {
- p += this.ct;
- --i;
- }
- }
- if (d > 0) m = true;
- if (m) r += bk(d);
- }
- }
- return m ? r : "0";
- };
- function aL() {
- var r = C();
- L.ZERO.cp(this, r);
- return r;
- };
- function cn() {
- return (this.s < 0) ? this.el() : this;
- };
- function aD(a) {
- var r = this.s - a.s;
- if (r != 0) return r;
- var i = this.t;
- r = i - a.t;
- if (r != 0) return (this.s < 0) ? -r : r;
- while (--i >= 0)
- if ((r = this[i] - a[i]) != 0) return r;
- return 0;
- };
- function bN(x) {
- var r = 1,
- t;
- if ((t = x >>> 16) != 0) {
- x = t;
- r += 16;
- }
- if ((t = x >> 8) != 0) {
- x = t;
- r += 8;
- }
- if ((t = x >> 4) != 0) {
- x = t;
- r += 4;
- }
- if ((t = x >> 2) != 0) {
- x = t;
- r += 2;
- }
- if ((t = x >> 1) != 0) {
- x = t;
- r += 1;
- }
- return r;
- };
- function dI() {
- if (this.t <= 0) return 0;
- return this.ct * (this.t - 1) + bN(this[this.t - 1] ^ (this.s & this.fi));
- };
- function da(n, r) {
- var i;
- for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i];
- for (i = n - 1; i >= 0; --i) r[i] = 0;
- r.t = this.t + n;
- r.s = this.s;
- };
- function cP(n, r) {
- for (var i = n; i < this.t; ++i) r[i - n] = this[i];
- r.t = Math.max(this.t - n, 0);
- r.s = this.s;
- };
- function cq(n, r) {
- var fD = n % this.ct;
- var gC = this.ct - fD;
- var hD = (1 << gC) - 1;
- var eL = Math.floor(n / this.ct),
- c = (this.s << fD) & this.fi,
- i;
- for (i = this.t - 1; i >= 0; --i) {
- r[i + eL + 1] = (this[i] >> gC) | c;
- c = (this[i] & hD) << fD;
- }
- for (i = eL - 1; i >= 0; --i) r[i] = 0;
- r[eL] = c;
- r.t = this.t + eL + 1;
- r.s = this.s;
- r.ff();
- };
- function dM(n, r) {
- r.s = this.s;
- var eL = Math.floor(n / this.ct);
- if (eL >= this.t) {
- r.t = 0;
- return;
- }
- var fD = n % this.ct;
- var gC = this.ct - fD;
- var hD = (1 << fD) - 1;
- r[0] = this[eL] >> fD;
- for (var i = eL + 1; i < this.t; ++i) {
- r[i - eL - 1] |= (this[i] & hD) << gC;
- r[i - eL] = this[i] >> fD;
- }
- if (fD > 0) r[this.t - eL - 1] |= (this.s & hD) << gC;
- r.t = this.t - eL;
- r.ff();
- };
- function de(a, r) {
- var i = 0,
- c = 0,
- m = Math.min(a.t, this.t);
- while (i < m) {
- c += this[i] - a[i];
- r[i++] = c & this.fi;
- c >>= this.ct;
- }
- if (a.t < this.t) {
- c -= a.s;
- while (i < this.t) {
- c += this[i];
- r[i++] = c & this.fi;
- c >>= this.ct;
- }
- c += this.s;
- } else {
- c += this.s;
- while (i < a.t) {
- c -= a[i];
- r[i++] = c & this.fi;
- c >>= this.ct;
- }
- c -= a.s;
- }
- r.s = (c < 0) ? -1 : 0;
- if (c < -1) r[i++] = this.ez + c;
- else if (c > 0) r[i++] = c;
- r.t = i;
- r.ff();
- };
- function bX(a, r) {
- var x = this.abs(),
- y = a.abs();
- var i = x.t;
- r.t = i + y.t;
- while (--i >= 0) r[i] = 0;
- for (i = 0; i < y.t; ++i) r[i + x.t] = x.eZ(0, y[i], r, i, 0, x.t);
- r.s = 0;
- r.ff();
- if (this.s != a.s) L.ZERO.cp(r, r);
- };
- function cr(r) {
- var x = this.abs();
- var i = r.t = 2 * x.t;
- while (--i >= 0) r[i] = 0;
- for (i = 0; i < x.t - 1; ++i) {
- var c = x.eZ(i, x[i], r, 2 * i, 0, 1);
- if ((r[i + x.t] += x.eZ(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.ez) {
- r[i + x.t] -= x.ez;
- r[i + x.t + 1] = 1;
- }
- }
- if (r.t > 0) r[r.t - 1] += x.eZ(i, x[i], r, 2 * i, 0, 1);
- r.s = 0;
- r.ff();
- };
- function dJ(m, q, r) {
- var hz = m.abs();
- if (hz.t <= 0) return;
- var pt = this.abs();
- if (pt.t < hz.t) {
- if (q != null) q.eT(0);
- if (r != null) this.eh(r);
- return;
- }
- if (r == null) r = C();
- var y = C(),
- jb = this.s,
- ms = m.s;
- var gP = this.ct - bN(hz[hz.t - 1]);
- if (gP > 0) {
- hz.gx(gP, y);
- pt.gx(gP, r);
- } else {
- hz.eh(y);
- pt.eh(r);
- }
- var fG = y.t;
- var gb = y[fG - 1];
- if (gb == 0) return;
- var jA = gb * (1 << this.iR) + ((fG > 1) ? y[fG - 2] >> this.io : 0);
- var kA = this.ku / jA,
- ko = (1 << this.iR) / jA,
- e = 1 << this.io;
- var i = r.t,
- j = i - fG,
- t = (q == null) ? C() : q;
- y.gS(j, t);
- if (r.dw(t) >= 0) {
- r[r.t++] = 1;
- r.cp(t, r);
- }
- L.ONE.gS(fG, t);
- t.cp(y, y);
- while (y.t < fG) y[y.t++] = 0;
- while (--j >= 0) {
- var gc = (r[--i] == gb) ? this.fi : Math.floor(r[i] * kA + (r[i - 1] + e) * ko);
- if ((r[i] += y.eZ(0, gc, r, j, 0, fG)) < gc) {
- y.gS(j, t);
- r.cp(t, r);
- while (r[i] < --gc) r.cp(t, r);
- }
- }
- if (q != null) {
- r.gJ(fG, q);
- if (jb != ms) L.ZERO.cp(q, q);
- }
- r.t = fG;
- r.ff();
- if (gP > 0) r.dY(gP, r);
- if (jb < 0) L.ZERO.cp(r, r);
- };
- function aZ(a) {
- var r = C();
- this.abs().fw(a, null, r);
- if (this.s < 0 && r.dw(L.ZERO) > 0) a.cp(r, r);
- return r;
- };
- function af(m) {
- this.m = m;
- };
- function ak(x) {
- if (x.s < 0 || x.dw(this.m) >= 0) return x.cl(this.m);
- else return x;
- };
- function aj(x) {
- return x;
- };
- function aU(x) {
- x.fw(this.m, null, x);
- };
- function bM(x, y, r) {
- x.gG(y, r);
- this.reduce(r);
- };
- function bE(x, r) {
- x.hc(r);
- this.reduce(r);
- };
- af.prototype.convert = ak;
- af.prototype.revert = aj;
- af.prototype.reduce = aU;
- af.prototype.fO = bM;
- af.prototype.eO = bE;
- function dh() {
- if (this.t < 1) return 0;
- var x = this[0];
- if ((x & 1) == 0) return 0;
- var y = x & 3;
- y = (y * (2 - (x & 0xf) * y)) & 0xf;
- y = (y * (2 - (x & 0xff) * y)) & 0xff;
- y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff;
- y = (y * (2 - x * y % this.ez)) % this.ez;
- return (y > 0) ? this.ez - y : -y;
- };
- function O(m) {
- this.m = m;
- this.ik = m.kC();
- this.jB = this.ik & 0x7fff;
- this.kl = this.ik >> 15;
- this.lf = (1 << (m.ct - 15)) - 1;
- this.kV = 2 * m.t;
- };
- function bC(x) {
- var r = C();
- x.abs().gS(this.m.t, r);
- r.fw(this.m, null, r);
- if (x.s < 0 && r.dw(L.ZERO) > 0) this.m.cp(r, r);
- return r;
- };
- function ax(x) {
- var r = C();
- x.eh(r);
- this.reduce(r);
- return r;
- };
- function au(x) {
- while (x.t <= this.kV) x[x.t++] = 0;
- for (var i = 0; i < this.m.t; ++i) {
- var j = x[i] & 0x7fff;
- var kh = (j * this.jB + (((j * this.kl + (x[i] >> 15) * this.jB) & this.lf) << 15)) & x.fi;
- j = i + this.m.t;
- x[j] += this.m.eZ(0, kh, x, i, 0, this.m.t);
- while (x[j] >= x.ez) {
- x[j] -= x.ez;
- x[++j]++;
- }
- }
- x.ff();
- x.gJ(this.m.t, x);
- if (x.dw(this.m) >= 0) x.cp(this.m, x);
- };
- function aC(x, r) {
- x.hc(r);
- this.reduce(r);
- };
- function bi(x, y, r) {
- x.gG(y, r);
- this.reduce(r);
- };
- O.prototype.convert = bC;
- O.prototype.revert = ax;
- O.prototype.reduce = au;
- O.prototype.fO = bi;
- O.prototype.eO = aC;
- function cz() {
- return ((this.t > 0) ? (this[0] & 1) : this.s) == 0;
- };
- function df(e, z) {
- if (e > 0xffffffff || e < 1) return L.ONE;
- var r = C(),
- r2 = C(),
- g = z.convert(this),
- i = bN(e) - 1;
- g.eh(r);
- while (--i >= 0) {
- z.eO(r, r2);
- if ((e & (1 << i)) > 0) z.fO(r2, g, r);
- else {
- var t = r;
- r = r2;
- r2 = t;
- }
- }
- return z.revert(r);
- };
- function bH(e, m) {
- var z;
- if (e < 256 || m.ef()) z = new af(m);
- else z = new O(m);
- return this.exp(e, z);
- };
- L.prototype.eh = dQ;
- L.prototype.eT = cS;
- L.prototype.hK = dc;
- L.prototype.ff = cf;
- L.prototype.gS = da;
- L.prototype.gJ = cP;
- L.prototype.gx = cq;
- L.prototype.dY = dM;
- L.prototype.cp = de;
- L.prototype.gG = bX;
- L.prototype.hc = cr;
- L.prototype.fw = dJ;
- L.prototype.kC = dh;
- L.prototype.ef = cz;
- L.prototype.exp = df;
- L.prototype.toString = aH;
- L.prototype.el = aL;
- L.prototype.abs = cn;
- L.prototype.dw = aD;
- L.prototype.fg = dI;
- L.prototype.cl = aZ;
- L.prototype.kr = bH;
- L.ZERO = H(0);
- L.ONE = H(1);
- function an() {
- var r = C();
- this.eh(r);
- return r;
- };
- function bK() {
- if (this.s < 0) {
- if (this.t == 1) return this[0] - this.ez;
- else if (this.t == 0) return -1;
- } else if (this.t == 1) return this[0];
- else if (this.t == 0) return 0;
- return ((this[1] & ((1 << (32 - this.ct)) - 1)) << this.ct) | this[0];
- };
- function cI() {
- return (this.t == 0) ? this.s : (this[0] << 24) >> 24;
- };
- function dn() {
- return (this.t == 0) ? this.s : (this[0] << 16) >> 16;
- };
- function ca(r) {
- return Math.floor(Math.LN2 * this.ct / Math.log(r));
- };
- function aF() {
- if (this.s < 0) return -1;
- else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0;
- else return 1;
- };
- function dk(b) {
- if (b == null) b = 10;
- if (this.eJ() == 0 || b < 2 || b > 36) return "0";
- var gf = this.iw(b);
- var a = Math.pow(b, gf);
- var d = H(a),
- y = C(),
- z = C(),
- r = "";
- this.fw(d, y, z);
- while (y.eJ() > 0) {
- r = (a + z.hs()).toString(b).substr(1) + r;
- y.fw(d, y, z);
- }
- return z.hs().toString(b) + r;
- };
- function bY(s, b) {
- this.eT(0);
- if (b == null) b = 10;
- var gf = this.iw(b);
- var d = Math.pow(b, gf),
- gO = false,
- j = 0,
- w = 0;
- for (var i = 0; i < s.length; ++i) {
- var x = bw(s, i);
- if (x < 0) {
- if (s.charAt(i) == "-" && this.eJ() == 0) gO = true;
- continue;
- }
- w = b * w + x;
- if (++j >= gf) {
- this.ja(d);
- this.hJ(w, 0);
- j = 0;
- w = 0;
- }
- }
- if (j > 0) {
- this.ja(Math.pow(b, j));
- this.hJ(w, 0);
- }
- if (gO) L.ZERO.cp(this, this);
- };
- function cX(a, b, c) {
- if ("number" == typeof b) {
- if (a < 2) this.eT(1);
- else {
- this.iM(a, c);
- if (!this.en(a - 1)) this.gj(L.ONE.shiftLeft(a - 1), ay, this);
- if (this.ef()) this.hJ(1, 0);
- while (!this.kv(b)) {
- this.hJ(2, 0);
- if (this.fg() > a) this.cp(L.ONE.shiftLeft(a - 1), this);
- }
- }
- } else {
- var x = new Array(),
- t = a & 7;
- x.length = (a >> 3) + 1;
- b.kj(x);
- if (t > 0) x[0] &= ((1 << t) - 1);
- else x[0] = 0;
- this.hK(x, 256);
- }
- };
- function bv() {
- var i = this.t,
- r = new Array();
- r[0] = this.s;
- var p = this.ct - (i * this.ct) % 8,
- d, k = 0;
- if (i-- > 0) {
- if (p < this.ct && (d = this[i] >> p) != (this.s & this.fi) >> p) r[k++] = d | (this.s << (this.ct - p));
- while (i >= 0) {
- if (p < 8) {
- d = (this[i] & ((1 << p) - 1)) << (8 - p);
- d |= this[--i] >> (p += this.ct - 8);
- } else {
- d = (this[i] >> (p -= 8)) & 0xff;
- if (p <= 0) {
- p += this.ct;
- --i;
- }
- }
- if ((d & 0x80) != 0) d |= -256;
- if (k == 0 && (this.s & 0x80) != (d & 0x80)) ++k;
- if (k > 0 || d != this.s) r[k++] = d;
- }
- }
- return r;
- };
- function ab(a) {
- return (this.dw(a) == 0);
- };
- function aw(a) {
- return (this.dw(a) < 0) ? this : a;
- };
- function ao(a) {
- return (this.dw(a) > 0) ? this : a;
- };
- function cC(a, hv, r) {
- var i, f, m = Math.min(a.t, this.t);
- for (i = 0; i < m; ++i) r[i] = hv(this[i], a[i]);
- if (a.t < this.t) {
- f = a.s & this.fi;
- for (i = m; i < this.t; ++i) r[i] = hv(this[i], f);
- r.t = this.t;
- } else {
- f = this.s & this.fi;
- for (i = m; i < a.t; ++i) r[i] = hv(f, a[i]);
- r.t = a.t;
- }
- r.s = hv(this.s, a.s);
- r.ff();
- };
- function aR(x, y) {
- return x & y;
- };
- function dN(a) {
- var r = C();
- this.gj(a, aR, r);
- return r;
- };
- function ay(x, y) {
- return x | y;
- };
- function bW(a) {
- var r = C();
- this.gj(a, ay, r);
- return r;
- };
- function aT(x, y) {
- return x ^ y;
- };
- function aQ(a) {
- var r = C();
- this.gj(a, aT, r);
- return r;
- };
- function ag(x, y) {
- return x & ~y;
- };
- function cg(a) {
- var r = C();
- this.gj(a, ag, r);
- return r;
- };
- function db() {
- var r = C();
- for (var i = 0; i < this.t; ++i) r[i] = this.fi & ~this[i];
- r.t = this.t;
- r.s = ~this.s;
- return r;
- };
- function cA(n) {
- var r = C();
- if (n < 0) this.dY(-n, r);
- else this.gx(n, r);
- return r;
- };
- function dv(n) {
- var r = C();
- if (n < 0) this.gx(-n, r);
- else this.dY(n, r);
- return r;
- };
- function aA(x) {
- if (x == 0) return -1;
- var r = 0;
- if ((x & 0xffff) == 0) {
- x >>= 16;
- r += 16;
- }
- if ((x & 0xff) == 0) {
- x >>= 8;
- r += 8;
- }
- if ((x & 0xf) == 0) {
- x >>= 4;
- r += 4;
- }
- if ((x & 3) == 0) {
- x >>= 2;
- r += 2;
- }
- if ((x & 1) == 0) ++r;
- return r;
- };
- function aq() {
- for (var i = 0; i < this.t; ++i)
- if (this[i] != 0) return i * this.ct + aA(this[i]);
- if (this.s < 0) return this.t * this.ct;
- return -1;
- };
- function ad(x) {
- var r = 0;
- while (x != 0) {
- x &= x - 1;
- ++r;
- }
- return r;
- };
- function cj() {
- var r = 0,
- x = this.s & this.fi;
- for (var i = 0; i < this.t; ++i) r += ad(this[i] ^ x);
- return r;
- };
- function aM(n) {
- var j = Math.floor(n / this.ct);
- if (j >= this.t) return (this.s != 0);
- return ((this[j] & (1 << (n % this.ct))) != 0);
- };
- function dE(n, hv) {
- var r = L.ONE.shiftLeft(n);
- this.gj(r, hv, r);
- return r;
- };
- function cc(n) {
- return this.hY(n, ay);
- };
- function cT(n) {
- return this.hY(n, ag);
- };
- function bb(n) {
- return this.hY(n, aT);
- };
- function ce(a, r) {
- var i = 0,
- c = 0,
- m = Math.min(a.t, this.t);
- while (i < m) {
- c += this[i] + a[i];
- r[i++] = c & this.fi;
- c >>= this.ct;
- }
- if (a.t < this.t) {
- c += a.s;
- while (i < this.t) {
- c += this[i];
- r[i++] = c & this.fi;
- c >>= this.ct;
- }
- c += this.s;
- } else {
- c += this.s;
- while (i < a.t) {
- c += a[i];
- r[i++] = c & this.fi;
- c >>= this.ct;
- }
- c += a.s;
- }
- r.s = (c < 0) ? -1 : 0;
- if (c > 0) r[i++] = c;
- else if (c < -1) r[i++] = this.ez + c;
- r.t = i;
- r.ff();
- };
- function cO(a) {
- var r = C();
- this.hG(a, r);
- return r;
- };
- function bQ(a) {
- var r = C();
- this.cp(a, r);
- return r;
- };
- function bF(a) {
- var r = C();
- this.gG(a, r);
- return r;
- };
- function aa() {
- var r = C();
- this.hc(r);
- return r;
- };
- function bd(a) {
- var r = C();
- this.fw(a, r, null);
- return r;
- };
- function cQ(a) {
- var r = C();
- this.fw(a, null, r);
- return r;
- };
- function bI(a) {
- var q = C(),
- r = C();
- this.fw(a, q, r);
- return new Array(q, r);
- };
- function dp(n) {
- this[this.t] = this.eZ(0, n - 1, this, 0, 0, this.t);
- ++this.t;
- this.ff();
- };
- function cJ(n, w) {
- if (n == 0) return;
- while (this.t <= w) this[this.t++] = 0;
- this[w] += n;
- while (this[w] >= this.ez) {
- this[w] -= this.ez;
- if (++w >= this.t) this[this.t++] = 0;
- ++this[w];
- }
- };
- function bj() { };
- function aY(x) {
- return x;
- };
- function aG(x, y, r) {
- x.gG(y, r);
- };
- function bA(x, r) {
- x.hc(r);
- };
- bj.prototype.convert = aY;
- bj.prototype.revert = aY;
- bj.prototype.fO = aG;
- bj.prototype.eO = bA;
- function cG(e) {
- return this.exp(e, new bj());
- };
- function cW(a, n, r) {
- var i = Math.min(this.t + a.t, n);
- r.s = 0;
- r.t = i;
- while (i > 0) r[--i] = 0;
- var j;
- for (j = r.t - this.t; i < j; ++i) r[i + this.t] = this.eZ(0, a[i], r, i, 0, this.t);
- for (j = Math.min(a.t, n); i < j; ++i) this.eZ(0, a[i], r, i, 0, n - i);
- r.ff();
- };
- function ci(a, n, r) {
- --n;
- var i = r.t = this.t + a.t - n;
- r.s = 0;
- while (--i >= 0) r[i] = 0;
- for (i = Math.max(n - this.t, 0); i < a.t; ++i) r[this.t + i - n] = this.eZ(n - i, a[i], r, 0, 0, this.t + i - n);
- r.ff();
- r.gJ(1, r);
- };
- function bh(m) {
- this.r2 = C();
- this.jx = C();
- L.ONE.gS(2 * m.t, this.r2);
- this.jQ = this.r2.divide(m);
- this.m = m;
- };
- function bu(x) {
- if (x.s < 0 || x.t > 2 * this.m.t) return x.cl(this.m);
- else if (x.dw(this.m) < 0) return x;
- else {
- var r = C();
- x.eh(r);
- this.reduce(r);
- return r;
- }
- };
- function aN(x) {
- return x;
- };
- function bS(x) {
- x.gJ(this.m.t - 1, this.r2);
- if (x.t > this.m.t + 1) {
- x.t = this.m.t + 1;
- x.ff();
- }
- this.jQ.ld(this.r2, this.m.t + 1, this.jx);
- this.m.lx(this.jx, this.m.t + 1, this.r2);
- while (x.dw(this.r2) < 0) x.hJ(1, this.m.t + 1);
- x.cp(this.r2, x);
- while (x.dw(this.m) >= 0) x.cp(this.m, x);
- };
- function dq(x, r) {
- x.hc(r);
- this.reduce(r);
- };
- function bU(x, y, r) {
- x.gG(y, r);
- this.reduce(r);
- };
- bh.prototype.convert = bu;
- bh.prototype.revert = aN;
- bh.prototype.reduce = bS;
- bh.prototype.fO = bU;
- bh.prototype.eO = dq;
- function aE(e, m) {
- var i = e.fg(),
- k, r = H(1),
- z;
- if (i <= 0) return r;
- else if (i < 18) k = 1;
- else if (i < 48) k = 3;
- else if (i < 144) k = 4;
- else if (i < 768) k = 5;
- else k = 6;
- if (i < 8) z = new af(m);
- else if (m.ef()) z = new bh(m);
- else z = new O(m);
- var g = new Array(),
- n = 3,
- hh = k - 1,
- hx = (1 << k) - 1;
- g[1] = z.convert(this);
- if (k > 1) {
- var jg = C();
- z.eO(g[1], jg);
- while (n <= hx) {
- g[n] = C();
- z.fO(jg, g[n - 2], g[n]);
- n += 2;
- }
- }
- var j = e.t - 1,
- w, iZ = true,
- r2 = C(),
- t;
- i = bN(e[j]) - 1;
- while (j >= 0) {
- if (i >= hh) w = (e[j] >> (i - hh)) & hx;
- else {
- w = (e[j] & ((1 << (i + 1)) - 1)) << (hh - i);
- if (j > 0) w |= e[j - 1] >> (this.ct + i - hh);
- }
- n = k;
- while ((w & 1) == 0) {
- w >>= 1;
- --n;
- }
- if ((i -= n) < 0) {
- i += this.ct;
- --j;
- }
- if (iZ) {
- g[w].eh(r);
- iZ = false;
- } else {
- while (n > 1) {
- z.eO(r, r2);
- z.eO(r2, r);
- n -= 2;
- }
- if (n > 0) z.eO(r, r2);
- else {
- t = r;
- r = r2;
- r2 = t;
- }
- z.fO(r2, g[w], r);
- }
- while (j >= 0 && (e[j] & (1 << i)) == 0) {
- z.eO(r, r2);
- t = r;
- r = r2;
- r2 = t;
- if (--i < 0) {
- i = this.ct - 1;
- --j;
- }
- }
- }
- return z.revert(r);
- };
- function aV(a) {
- var x = (this.s < 0) ? this.el() : this.clone();
- var y = (a.s < 0) ? a.el() : a.clone();
- if (x.dw(y) < 0) {
- var t = x;
- x = y;
- y = t;
- }
- var i = x.gg(),
- g = y.gg();
- if (g < 0) return x;
- if (i < g) g = i;
- if (g > 0) {
- x.dY(g, x);
- y.dY(g, y);
- }
- while (x.eJ() > 0) {
- if ((i = x.gg()) > 0) x.dY(i, x);
- if ((i = y.gg()) > 0) y.dY(i, y);
- if (x.dw(y) >= 0) {
- x.cp(y, x);
- x.dY(1, x);
- } else {
- y.cp(x, y);
- y.dY(1, y);
- }
- }
- if (g > 0) y.gx(g, y);
- return y;
- };
- function di(n) {
- if (n <= 0) return 0;
- var d = this.ez % n,
- r = (this.s < 0) ? n - 1 : 0;
- if (this.t > 0)
- if (d == 0) r = this[0] % n;
- else
- for (var i = this.t - 1; i >= 0; --i) r = (d * r + this[i]) % n;
- return r;
- };
- function ah(m) {
- var fY = m.ef();
- if ((this.ef() && fY) || m.eJ() == 0) return L.ZERO;
- var u = m.clone(),
- v = this.clone();
- var a = H(1),
- b = H(0),
- c = H(0),
- d = H(1);
- while (u.eJ() != 0) {
- while (u.ef()) {
- u.dY(1, u);
- if (fY) {
- if (!a.ef() || !b.ef()) {
- a.hG(this, a);
- b.cp(m, b);
- }
- a.dY(1, a);
- } else if (!b.ef()) b.cp(m, b);
- b.dY(1, b);
- }
- while (v.ef()) {
- v.dY(1, v);
- if (fY) {
- if (!c.ef() || !d.ef()) {
- c.hG(this, c);
- d.cp(m, d);
- }
- c.dY(1, c);
- } else if (!d.ef()) d.cp(m, d);
- d.dY(1, d);
- }
- if (u.dw(v) >= 0) {
- u.cp(v, u);
- if (fY) a.cp(c, a);
- b.cp(d, b);
- } else {
- v.cp(u, v);
- if (fY) c.cp(a, c);
- d.cp(b, d);
- }
- }
- if (v.dw(L.ONE) != 0) return L.ZERO;
- if (d.dw(m) >= 0) return d.cv(m);
- if (d.eJ() < 0) d.hG(m, d);
- else return d;
- if (d.eJ() < 0) return d.add(m);
- else return d;
- };
- var eb = [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
- ];
- var kE = (1 << 26) / eb[eb.length - 1];
- function as(t) {
- var i, x = this.abs();
- if (x.t == 1 && x[0] <= eb[eb.length - 1]) {
- for (i = 0; i < eb.length; ++i)
- if (x[0] == eb[i]) return true;
- return false;
- }
- if (x.ef()) return false;
- i = 1;
- while (i < eb.length) {
- var m = eb[i],
- j = i + 1;
- while (j < eb.length && m < kE) m *= eb[j++];
- m = x.kq(m);
- while (i < j)
- if (m % eb[i++] == 0) return false;
- }
- return x.kJ(t);
- };
- function dR(t) {
- var gV = this.cv(L.ONE);
- var k = gV.gg();
- if (k <= 0) return false;
- var r = gV.ic(k);
- t = (t + 1) >> 1;
- if (t > eb.length) t = eb.length;
- var a = C();
- for (var i = 0; i < t; ++i) {
- a.eT(eb[Math.floor(Math.random() * eb.length)]);
- var y = a.lb(r, this);
- if (y.dw(L.ONE) != 0 && y.dw(gV) != 0) {
- var j = 1;
- while (j++ < k && y.dw(gV) != 0) {
- y = y.kr(2, this);
- if (y.dw(L.ONE) == 0) return false;
- }
- if (y.dw(gV) != 0) return false;
- }
- }
- return true;
- };
- L.prototype.iw = ca;
- L.prototype.eD = dk;
- L.prototype.jP = bY;
- L.prototype.iM = cX;
- L.prototype.gj = cC;
- L.prototype.hY = dE;
- L.prototype.hG = ce;
- L.prototype.ja = dp;
- L.prototype.hJ = cJ;
- L.prototype.lx = cW;
- L.prototype.ld = ci;
- L.prototype.kq = di;
- L.prototype.kJ = dR;
- L.prototype.clone = an;
- L.prototype.hs = bK;
- L.prototype.lQ = cI;
- L.prototype.lZ = dn;
- L.prototype.eJ = aF;
- L.prototype.gv = bv;
- L.prototype.equals = ab;
- L.prototype.min = aw;
- L.prototype.max = ao;
- L.prototype.and = dN;
- L.prototype.jw = bW;
- L.prototype.xor = aQ;
- L.prototype.mg = cg;
- L.prototype.not = db;
- L.prototype.shiftLeft = cA;
- L.prototype.ic = dv;
- L.prototype.gg = aq;
- L.prototype.nx = cj;
- L.prototype.en = aM;
- L.prototype.nu = cc;
- L.prototype.mR = cT;
- L.prototype.nc = bb;
- L.prototype.add = cO;
- L.prototype.cv = bQ;
- L.prototype.multiply = bF;
- L.prototype.divide = bd;
- L.prototype.mU = cQ;
- L.prototype.lH = bI;
- L.prototype.lb = aE;
- L.prototype.fZ = ah;
- L.prototype.pow = cG;
- L.prototype.mN = aV;
- L.prototype.kv = as;
- L.prototype.square = aa;
- function J(q, x) {
- this.x = x;
- this.q = q;
- };
- function bx(other) {
- if (other == this) return true;
- return (this.q.equals(other.q) && this.x.equals(other.x));
- };
- function av() {
- return this.x;
- };
- function aO() {
- return new J(this.q, this.x.el().cl(this.q));
- };
- function bz(b) {
- return new J(this.q, this.x.add(b.cR()).cl(this.q));
- };
- function be(b) {
- return new J(this.q, this.x.cv(b.cR()).cl(this.q));
- };
- function bf(b) {
- return new J(this.q, this.x.multiply(b.cR()).cl(this.q));
- };
- function aJ() {
- return new J(this.q, this.x.square().cl(this.q));
- };
- function ar(b) {
- return new J(this.q, this.x.multiply(b.cR().fZ(this.q)).cl(this.q));
- };
- J.prototype.equals = bx;
- J.prototype.cR = av;
- J.prototype.el = aO;
- J.prototype.add = bz;
- J.prototype.cv = be;
- J.prototype.multiply = bf;
- J.prototype.square = aJ;
- J.prototype.divide = ar;
- function G(dP, x, y, z) {
- this.dP = dP;
- this.x = x;
- this.y = y;
- if (z == null) {
- this.z = L.ONE;
- } else {
- this.z = z;
- }
- this.gH = null;
- };
- function az() {
- if (this.gH == null) {
- this.gH = this.z.fZ(this.dP.q);
- }
- return this.dP.fm(this.x.cR().multiply(this.gH).cl(this.dP.q));
- };
- function bP() {
- if (this.gH == null) {
- this.gH = this.z.fZ(this.dP.q);
- }
- return this.dP.fm(this.y.cR().multiply(this.gH).cl(this.dP.q));
- };
- function bV(other) {
- if (other == this) return true;
- if (this.eg()) return other.eg();
- if (other.eg()) return this.eg();
- var u, v;
- u = other.y.cR().multiply(this.z).cv(this.y.cR().multiply(other.z)).cl(this.dP.q);
- if (!u.equals(L.ZERO)) return false;
- v = other.x.cR().multiply(this.z).cv(this.x.cR().multiply(other.z)).cl(this.dP.q);
- return v.equals(L.ZERO);
- };
- function bp() {
- if ((this.x == null) && (this.y == null)) return true;
- return this.z.equals(L.ZERO) && !this.y.cR().equals(L.ZERO);
- };
- function aX() {
- return new G(this.dP, this.x, this.y.el(), this.z);
- };
- function aB(b) {
- if (this.eg()) return b;
- if (b.eg()) return this;
- var u = b.y.cR().multiply(this.z).cv(this.y.cR().multiply(b.z)).cl(this.dP.q);
- var v = b.x.cR().multiply(this.z).cv(this.x.cR().multiply(b.z)).cl(this.dP.q);
- if (L.ZERO.equals(v)) {
- if (L.ZERO.equals(u)) {
- return this.gI();
- }
- return this.dP.gy();
- }
- var hm = new L("3");
- var x1 = this.x.cR();
- var y1 = this.y.cR();
- var iT = v.square();
- var hq = iT.multiply(v);
- var iy = x1.multiply(iT);
- var iq = u.square().multiply(this.z);
- var eE = iq.cv(iy.shiftLeft(1)).multiply(b.z).cv(hq).multiply(v).cl(this.dP.q);
- var fE = iy.multiply(hm).multiply(u).cv(y1.multiply(hq)).cv(iq.multiply(u)).multiply(b.z).add(u.multiply(hq)).cl(this
- .dP.q);
- var js = hq.multiply(this.z).multiply(b.z).cl(this.dP.q);
- return new G(this.dP, this.dP.fm(eE), this.dP.fm(fE), js);
- };
- function bq() {
- if (this.eg()) return this;
- if (this.y.cR().eJ() == 0) return this.dP.gy();
- var hm = new L("3");
- var x1 = this.x.cR();
- var y1 = this.y.cR();
- var gz = y1.multiply(this.z);
- var jp = gz.multiply(y1).cl(this.dP.q);
- var a = this.dP.a.cR();
- var w = x1.square().multiply(hm);
- if (!L.ZERO.equals(a)) {
- w = w.add(this.z.square().multiply(a));
- }
- w = w.cl(this.dP.q);
- var eE = w.square().cv(x1.shiftLeft(3).multiply(jp)).shiftLeft(1).multiply(gz).cl(this.dP.q);
- var fE = w.multiply(hm).multiply(x1).cv(jp.shiftLeft(1)).shiftLeft(2).multiply(jp).cv(w.square().multiply(w)).cl(this
- .dP.q);
- var js = gz.square().multiply(gz).shiftLeft(3).cl(this.dP.q);
- return new G(this.dP, this.dP.fm(eE), this.dP.fm(fE), js);
- };
- function ai(k) {
- if (this.eg()) return this;
- if (k.eJ() == 0) return this.dP.gy();
- var e = k;
- var h = e.multiply(new L("3"));
- var hw = this.el();
- var R = this;
- var i;
- for (i = h.fg() - 2; i > 0; --i) {
- R = R.gI();
- var gm = h.en(i);
- var hV = e.en(i);
- if (gm != hV) {
- R = R.add(gm ? this : hw);
- }
- }
- return R;
- };
- function aS(j, x, k) {
- var i;
- if (j.fg() > k.fg()) i = j.fg() - 1;
- else i = k.fg() - 1;
- var R = this.dP.gy();
- var both = this.add(x);
- while (i >= 0) {
- R = R.gI();
- if (j.en(i)) {
- if (k.en(i)) {
- R = R.add(both);
- } else {
- R = R.add(this);
- }
- } else {
- if (k.en(i)) {
- R = R.add(x);
- }
- } --i;
- }
- return R;
- };
- G.prototype.fI = az;
- G.prototype.ec = bP;
- G.prototype.equals = bV;
- G.prototype.eg = bp;
- G.prototype.el = aX;
- G.prototype.add = aB;
- G.prototype.gI = bq;
- G.prototype.multiply = ai;
- G.prototype.nb = aS;
- function V(q, a, b) {
- this.q = q;
- this.a = this.fm(a);
- this.b = this.fm(b);
- this.jz = new G(this, null, null);
- };
- function bO() {
- return this.q;
- };
- function aW() {
- return this.a;
- };
- function bc() {
- return this.b;
- };
- function bJ(other) {
- if (other == this) return true;
- return (this.q.equals(other.q) && this.a.equals(other.a) && this.b.equals(other.b));
- };
- function bn() {
- return this.jz;
- };
- function ae(x) {
- return new J(this.q, x);
- };
- function by(s) {
- switch (parseInt(s.substr(0, 2), 16)) {
- case 0:
- return this.jz;
- case 2:
- case 3:
- return null;
- case 4:
- case 6:
- case 7:
- var dm = (s.length - 2) / 2;
- var hf = s.substr(2, dm);
- var ih = s.substr(dm + 2, dm);
- return new G(this, this.fm(new L(hf, 16)), this.fm(new L(ih, 16)));
- default:
- return null;
- }
- };
- function bG(x, y) {
- return new G(this, this.fm(x), this.fm(y));
- };
- V.prototype.jh = bO;
- V.prototype.kH = aW;
- V.prototype.kB = bc;
- V.prototype.equals = bJ;
- V.prototype.gy = bn;
- V.prototype.fm = ae;
- V.prototype.kR = by;
- V.prototype.kU = bG;
- J.prototype.lO = function () {
- return Math.floor((this.cR().fg() + 7) / 8);
- };
- G.prototype.mj = function (jG) {
- var hM = function (i, dm) {
- var ev = i.lW();
- if (dm < ev.length) {
- ev = ev.slice(ev.length - dm);
- } else
- while (dm > ev.length) {
- ev.unshift(0);
- }
- return ev;
- };
- var x = this.fI().cR();
- var y = this.ec().cR();
- var ey = hM(x, 32);
- if (jG) {
- if (y.ef()) {
- ey.unshift(0x02);
- } else {
- ey.unshift(0x03);
- }
- } else {
- ey.unshift(0x04);
- ey = ey.concat(hM(y, 32));
- }
- return ey;
- };
- G.jZ = function (dP, ey) {
- var ea = ey.length - 1;
- var iP = ey.slice(1, 1 + ea / 2);
- var je = ey.slice(1 + ea / 2, 1 + ea);
- iP.unshift(0);
- je.unshift(0);
- var x = new L(iP);
- var y = new L(je);
- return new G(dP, dP.fm(x), dP.fm(y));
- };
- G.hQ = function (dP, hU) {
- var ea = hU.length - 2;
- var hf = hU.substr(2, ea / 2);
- var ih = hU.substr(2 + ea / 2, ea / 2);
- var x = new L(hf, 16);
- var y = new L(ih, 16);
- return new G(dP, dP.fm(x), dP.fm(y));
- };
- G.prototype.jK = function (b) {
- if (this.eg()) return b;
- if (b.eg()) return this;
- if (this.x.equals(b.x)) {
- if (this.y.equals(b.y)) {
- return this.gI();
- }
- return this.dP.gy();
- }
- var kW = b.x.cv(this.x);
- var la = b.y.cv(this.y);
- var hl = la.divide(kW);
- var eE = hl.square().cv(this.x).cv(b.x);
- var fE = hl.multiply(this.x.cv(eE)).cv(this.y);
- return new G(this.dP, eE, fE);
- };
- G.prototype.mV = function () {
- if (this.eg()) return this;
- if (this.y.cR().eJ() == 0) {
- return this.dP.gy();
- }
- var jF = this.dP.fm(L.valueOf(2));
- var hm = this.dP.fm(L.valueOf(3));
- var hl = this.x.square().multiply(hm).add(this.dP.a).divide(this.y.multiply(jF));
- var eE = hl.square().cv(this.x.multiply(jF));
- var fE = hl.multiply(this.x.cv(eE)).cv(this.y);
- return new G(this.dP, eE, fE);
- };
- G.prototype.nl = function (k) {
- if (this.eg()) return this;
- if (k.eJ() == 0) return this.dP.gy();
- var e = k;
- var h = e.multiply(new L("3"));
- var hw = this.el();
- var R = this;
- var i;
- for (i = h.fg() - 2; i > 0; --i) {
- R = R.gI();
- var gm = h.en(i);
- var hV = e.en(i);
- if (gm != hV) {
- R = R.jK(gm ? this : hw);
- }
- }
- return R;
- };
- G.prototype.kM = function () {
- var x = this.fI().cR();
- var y = this.ec().cR();
- var a = this.dP.kH().cR();
- var b = this.dP.kB().cR();
- var n = this.dP.jh();
- var lhs = y.multiply(y).cl(n);
- var rhs = x.multiply(x).multiply(x).add(a.multiply(x)).add(b).cl(n);
- return lhs.equals(rhs);
- };
- G.prototype.toString = function () {
- return '(' + this.fI().cR().toString() + ',' + this.ec().cR().toString() + ')';
- };
- G.prototype.mY = function () {
- var n = this.dP.jh();
- if (this.eg()) {
- throw new Error("Point is at jz.");
- }
- var x = this.fI().cR();
- var y = this.ec().cR();
- if (x.dw(L.ONE) < 0 || x.dw(n.cv(L.ONE)) > 0) {
- throw new Error('x coordinate out of bounds');
- }
- if (y.dw(L.ONE) < 0 || y.dw(n.cv(L.ONE)) > 0) {
- throw new Error('y coordinate out of bounds');
- }
- if (!this.kM()) {
- throw new Error("Point is not on the dP.");
- }
- if (this.multiply(n).eg()) {
- throw new Error("Point is not a scalar multiple of G.");
- }
- return true;
- };
- function bo() {
- this.fB = null;
- this.et = null;
- this.iA = null;
- this.hb = 256;
- this.ho = 0;
- this.gR = 0;
- this.eu = new Array();
- if (this.fB == null) {
- this.fB = new Array();
- this.et = 0;
- if (navigator.appName == "Netscape" && navigator.appVersion < "5" && window.crypto) {
- var z = window.crypto.random(32);
- for (var t = 0; t < z.length; ++t) {
- this.fB[this.et++] = z.charCodeAt(t) & 255;
- }
- }
- while (this.et < this.hb) {
- t = Math.floor(65536 * Math.random());
- this.fB[this.et++] = t >>> 8;
- this.fB[this.et++] = t & 255;
- }
- this.et = 0;
- this.jj();
- }
- };
- bo.prototype = {
- ka: function (x) {
- this.fB[this.et++] ^= x & 255;
- this.fB[this.et++] ^= (x >> 8) & 255;
- this.fB[this.et++] ^= (x >> 16) & 255;
- this.fB[this.et++] ^= (x >> 24) & 255;
- if (this.et >= this.hb) this.et -= this.hb;
- },
- jj: function () {
- this.ka(new Date().getTime());
- },
- kg: function () {
- if (this.iA == null) {
- this.jj();
- this.iA = 1;
- this.gD(this.fB);
- for (var et = 0; et < this.fB.length; ++et) {
- this.fB[et] = 0;
- }
- this.et = 0;
- }
- return this.next();
- },
- kj: function (iQ) {
- var i;
- for (i = 0; i < iQ.length; ++i) iQ[i] = this.kg();
- },
- gD: function (key) {
- var i, j, t;
- for (i = 0; i < 256; ++i) this.eu[i] = i;
- j = 0;
- for (i = 0; i < 256; ++i) {
- j = (j + this.eu[i] + key[i % key.length]) & 255;
- t = this.eu[i];
- this.eu[i] = this.eu[j];
- this.eu[j] = t;
- }
- this.ho = 0;
- this.gR = 0;
- },
- next: function () {
- var t;
- this.ho = (this.ho + 1) & 255;
- this.gR = (this.gR + this.eu[this.ho]) & 255;
- t = this.eu[this.ho];
- this.eu[this.ho] = this.eu[this.gR];
- this.eu[this.gR] = t;
- return this.eu[(t + this.eu[this.ho]) & 255];
- }
- };
- function aP() {
- this.dX = new Array(0xd6, 0x90, 0xe9, 0xfe, 0xcc, 0xe1, 0x3d, 0xb7, 0x16, 0xb6, 0x14, 0xc2, 0x28, 0xfb, 0x2c, 0x05,
- 0x2b, 0x67, 0x9a, 0x76, 0x2a, 0xbe, 0x04, 0xc3, 0xaa, 0x44, 0x13, 0x26, 0x49, 0x86, 0x06, 0x99, 0x9c, 0x42, 0x50,
- 0xf4, 0x91, 0xef, 0x98, 0x7a, 0x33, 0x54, 0x0b, 0x43, 0xed, 0xcf, 0xac, 0x62, 0xe4, 0xb3, 0x1c, 0xa9, 0xc9, 0x08,
- 0xe8, 0x95, 0x80, 0xdf, 0x94, 0xfa, 0x75, 0x8f, 0x3f, 0xa6, 0x47, 0x07, 0xa7, 0xfc, 0xf3, 0x73, 0x17, 0xba, 0x83,
- 0x59, 0x3c, 0x19, 0xe6, 0x85, 0x4f, 0xa8, 0x68, 0x6b, 0x81, 0xb2, 0x71, 0x64, 0xda, 0x8b, 0xf8, 0xeb, 0x0f, 0x4b,
- 0x70, 0x56, 0x9d, 0x35, 0x1e, 0x24, 0x0e, 0x5e, 0x63, 0x58, 0xd1, 0xa2, 0x25, 0x22, 0x7c, 0x3b, 0x01, 0x21, 0x78,
- 0x87, 0xd4, 0x00, 0x46, 0x57, 0x9f, 0xd3, 0x27, 0x52, 0x4c, 0x36, 0x02, 0xe7, 0xa0, 0xc4, 0xc8, 0x9e, 0xea, 0xbf,
- 0x8a, 0xd2, 0x40, 0xc7, 0x38, 0xb5, 0xa3, 0xf7, 0xf2, 0xce, 0xf9, 0x61, 0x15, 0xa1, 0xe0, 0xae, 0x5d, 0xa4, 0x9b,
- 0x34, 0x1a, 0x55, 0xad, 0x93, 0x32, 0x30, 0xf5, 0x8c, 0xb1, 0xe3, 0x1d, 0xf6, 0xe2, 0x2e, 0x82, 0x66, 0xca, 0x60,
- 0xc0, 0x29, 0x23, 0xab, 0x0d, 0x53, 0x4e, 0x6f, 0xd5, 0xdb, 0x37, 0x45, 0xde, 0xfd, 0x8e, 0x2f, 0x03, 0xff, 0x6a,
- 0x72, 0x6d, 0x6c, 0x5b, 0x51, 0x8d, 0x1b, 0xaf, 0x92, 0xbb, 0xdd, 0xbc, 0x7f, 0x11, 0xd9, 0x5c, 0x41, 0x1f, 0x10,
- 0x5a, 0xd8, 0x0a, 0xc1, 0x31, 0x88, 0xa5, 0xcd, 0x7b, 0xbd, 0x2d, 0x74, 0xd0, 0x12, 0xb8, 0xe5, 0xb4, 0xb0, 0x89,
- 0x69, 0x97, 0x4a, 0x0c, 0x96, 0x77, 0x7e, 0x65, 0xb9, 0xf1, 0x09, 0xc5, 0x6e, 0xc6, 0x84, 0x18, 0xf0, 0x7d, 0xec,
- 0x3a, 0xdc, 0x4d, 0x20, 0x79, 0xee, 0x5f, 0x3e, 0xd7, 0xcb, 0x39, 0x48);
- this.gi = new Array(0xa3b1bac6, 0x56aa3350, 0x677d9197, 0xb27022dc);
- this.kw = new Array(0x00070e15, 0x1c232a31, 0x383f464d, 0x545b6269, 0x70777e85, 0x8c939aa1, 0xa8afb6bd, 0xc4cbd2d9,
- 0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249, 0x50575e65, 0x6c737a81, 0x888f969d, 0xa4abb2b9, 0xc0c7ced5,
- 0xdce3eaf1, 0xf8ff060d, 0x141b2229, 0x30373e45, 0x4c535a61, 0x686f767d, 0x848b9299, 0xa0a7aeb5, 0xbcc3cad1,
- 0xd8dfe6ed, 0xf4fb0209, 0x10171e25, 0x2c333a41, 0x484f565d, 0x646b7279);
- };
- aP.prototype = {
- hy: function (key) {
- var k = new Array(36);
- var gM = aI(key);
- k[0] = gM[0] ^ this.gi[0];
- k[1] = gM[1] ^ this.gi[1];
- k[2] = gM[2] ^ this.gi[2];
- k[3] = gM[3] ^ this.gi[3];
- var fH = new Array(32);
- for (var i = 0; i < 32; i++) {
- k[(i + 4)] = (k[i] ^ this.jO(k[(i + 1)] ^ k[(i + 2)] ^ k[(i + 3)] ^ this.kw[i]));
- fH[i] = k[(i + 4)];
- }
- return fH;
- },
- jO: function (fS) {
- var b = new Array(4);
- var a = F(fS);
- b[0] = this.dX[a[0] & 0xFF];
- b[1] = this.dX[a[1] & 0xFF];
- b[2] = this.dX[a[2] & 0xFF];
- b[3] = this.dX[a[3] & 0xFF];
- var ek = bB(b, 0);
- var fH = ek ^ (ek << 13 | (ek >>> (32 - 13))) ^ (ek << 23 | (ek >>> (32 - 23)));
- return fH;
- },
- eA: function (fH, data) {
- var x = new Array(36);
- x[0] = bB(data, 0);
- x[1] = bB(data, 4);
- x[2] = bB(data, 8);
- x[3] = bB(data, 12);
- for (var i = 0; i < 32; i++) {
- x[(i + 4)] = x[i] ^ this.kN(x[(i + 1)] ^ x[(i + 2)] ^ x[(i + 3)] ^ fH[i]);
- }
- var iI = new Array(4);
- for (var i = 35; i >= 32; i--) {
- iI[35 - i] = x[i];
- }
- var kS = ap(iI);
- return kS;
- },
- kN: function (fS) {
- var a = F(fS);
- var b = new Array(4);
- b[0] = this.dX[a[0] & 0xFF];
- b[1] = this.dX[a[1] & 0xFF];
- b[2] = this.dX[a[2] & 0xFF];
- b[3] = this.dX[a[3] & 0xFF];
- var ek = bB(b, 0);
- var c = ek ^ (ek << 2 | (ek >>> (32 - 2))) ^ (ek << 10 | (ek >>> (32 - 10))) ^ (ek << 18 | (ek >>> (32 - 18))) ^
- (ek << 24 | (ek >>> (32 - 24)));
- return c;
- },
- gY: function (input, mode) {
- if (input == null) {
- return null;
- }
- var gT = null;
- if (mode == 1) {
- var p = 16 - input.length % 16;
- gT = new Array(input.length + p);
- K(input, 0, gT, 0, input.length);
- for (var i = 0; i < p; i++) {
- gT[input.length + i] = p;
- }
- } else {
- var p = input[input.length - 1];
- gT = new Array(input.length - p);
- K(input, 0, gT, 0, input.length - p);
- }
- return gT;
- },
- lk: function (data, key) {
- if (data == undefined || data == null || data.length <= 0) {
- dB.log("data is error!");
- return null;
- }
- if (key == undefined || key == null || key.length % 16 != 0) {
- dB.log("dV key is error!");
- return null;
- }
- var fH = this.hy(key);
- var cU = 16;
- var loop = parseInt(data.length / cU);
- var cw = new Array((loop + 1) * cU);
- var dF = new Array(cU);
- var hk = null;
- for (var i = 0; i < loop; i++) {
- K(data, i * cU, dF, 0, cU);
- hk = this.eA(fH, dF);
- K(hk, 0, cw, i * cU, cU);
- }
- var eR = new Array(data.length % cU);
- if (eR.length > 0) {
- K(data, loop * cU, eR, 0, data.length % cU);
- }
- var padding = this.gY(eR, 1);
- hk = this.eA(fH, padding);
- K(hk, 0, cw, loop * cU, cU);
- return cw;
- },
- kY: function (data, key) {
- if (data == undefined || data == null || data.length % 16 != 0) {
- dB.log("data is error!");
- return null;
- }
- if (key == undefined || key == null || key.length % 16 != 0) {
- dB.log("dV key is error!");
- return null;
- }
- var fH = this.hy(key);
- var gW = new Array(32);
- for (var i = 0; i < fH.length; i++) {
- gW[i] = fH[32 - i - 1];
- }
- var cU = 16;
- var loop = data.length / cU - 1;
- var dF = new Array(cU);
- var fh = null;
- var fz = null;
- K(data, loop * cU, dF, 0, cU);
- fh = this.eA(gW, dF);
- var eY = this.gY(fh, 0);
- fz = new Array(loop * cU + eY.length);
- K(eY, 0, fz, loop * cU, eY.length);
- for (var i = 0; i < loop; i++) {
- K(data, i * cU, dF, 0, cU);
- fh = this.eA(gW, dF);
- K(fh, 0, fz, i * cU, cU);
- }
- return fz;
- },
- ll: function (data, key, cd) {
- if (cd == undefined || cd == null || cd.length % 16 != 0) {
- dB.log("cd is error!");
- return null;
- }
- if (key == undefined || key == null || key.length % 16 != 0) {
- dB.log("dV key is error!");
- return null;
- }
- if (data == undefined || data == null || data.length <= 0) {
- dB.log("data is error!");
- return null;
- }
- var fH = this.hy(key);
- var cU = 16;
- var loop = parseInt(data.length / cU);
- var cw = new Array((loop + 1) * cU);
- var dF = new Array(cU);
- for (var i = 0; i < loop; i++) {
- K(data, i * cU, dF, 0, cU);
- for (var j = 0; j < cU; j++) {
- dF[j] = dF[j] ^ cd[j];
- }
- cd = this.eA(fH, dF);
- K(cd, 0, cw, i * cU, cU);
- }
- var eR = new Array(data.length % cU);
- if (eR.length > 0) {
- K(data, loop * cU, eR, 0, data.length % cU);
- }
- var padding = this.gY(eR, 1);
- for (var i = 0; i < cU; i++) {
- padding[i] = padding[i] ^ cd[i];
- }
- cd = this.eA(fH, padding);
- K(cd, 0, cw, loop * cU, cU);
- return cw;
- },
- kD: function (data, key, cd) {
- if (cd == undefined || cd == null || cd.length % 16 != 0) {
- dB.log("cd is error!");
- return null;
- }
- if (key == undefined || key == null || key.length % 16 != 0) {
- dB.log("dV key is error!");
- return null;
- }
- if (data == undefined || data == null || data.length % 16 != 0) {
- dB.log("data is error!");
- return null;
- }
- var fH = this.hy(key);
- var gW = new Array(32);
- for (var i = 0; i < fH.length; i++) {
- gW[i] = fH[32 - i - 1];
- }
- var cU = 16;
- var loop = data.length / cU;
- var dF = new Array(cU);
- var fh = null;
- var fz = null;
- fz = new Array(data.length);
- for (var i = 0; i < loop; i++) {
- K(data, i * cU, dF, 0, cU);
- fh = this.eA(gW, dF);
- for (var j = 0; j < cU; j++) {
- fh[j] = fh[j] ^ cd[j];
- }
- K(dF, 0, cd, 0, cU);
- K(fh, 0, fz, i * cU, cU);
- }
- var eY = this.gY(fh, 0);
- var gq = new Array(fz.length - cU + eY.length);
- K(fz, 0, gq, 0, fz.length - cU);
- K(eY, 0, gq, fz.length - cU, eY.length);
- return gq;
- }
- };
- function T() {
- this.ft = new Array();
- this.eW = 0;
- this.hB = 0;
- this.hZ = 32;
- this.gU = [0x7380166f, 0x4914b2b9, 0x172442d7, 0xda8a0600, 0xa96f30bc, 0x163138aa, 0xe38dee4d, 0xb0fb0e4e];
- this.gU = [0x7380166f, 0x4914b2b9, 0x172442d7, -628488704, -1452330820, 0x163138aa, -477237683, -1325724082];
- this.v = new Array(8);
- this.jJ = new Array(8);
- this.fU = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- this.X = new Array(68);
- this.eI = 0;
- this.lw = 0x79cc4519;
- this.lz = 0x7a879d8a;
- if (arguments.length > 0) {
- this.lc(arguments[0]);
- } else {
- this.gD();
- }
- };
- T.prototype = {
- dj: {
- ki: -parseInt('10000000000000000000000000000000', 2),
- ir: parseInt('1111111111111111111111111111111', 2),
- parse: function (n) {
- if (n < this.ki) {
- var fa = new Number(-n);
- var fe = fa.toString(2);
- var dU = fe.substr(fe.length - 31, 31);
- var fC = '';
- for (var i = 0; i < dU.length; i++) {
- var hE = dU.substr(i, 1);
- fC += hE == '0' ? '1' : '0';
- }
- var result = parseInt(fC, 2);
- return (result + 1);
- } else if (n > this.ir) {
- var fa = Number(n);
- var fe = fa.toString(2);
- var dU = fe.substr(fe.length - 31, 31);
- var fC = '';
- for (var i = 0; i < dU.length; i++) {
- var hE = dU.substr(i, 1);
- fC += hE == '0' ? '1' : '0';
- }
- var result = parseInt(fC, 2);
- return -(result + 1);
- } else {
- return n;
- }
- },
- gK: function (n) {
- if (n < 0) {
- var fa = new Number(-n);
- var fe = fa.toString(2);
- var dU = fe.substr(fe.length - 8, 8);
- var fC = '';
- for (var i = 0; i < dU.length; i++) {
- var hE = dU.substr(i, 1);
- fC += hE == '0' ? '1' : '0';
- }
- var result = parseInt(fC, 2);
- return (result + 1);
- } else if (n > 255) {
- var fa = Number(n);
- var fe = fa.toString(2);
- return parseInt(fe.substr(fe.length - 8, 8), 2);
- } else {
- return n;
- }
- }
- },
- gD: function () {
- this.ft = new Array(4);
- this.reset();
- },
- lc: function (t) {
- this.ft = [].concat(t.ft);
- this.eW = t.eW;
- this.hB = t.hB;
- K(t.X, 0, this.X, 0, t.X.length);
- this.eI = t.eI;
- K(t.v, 0, this.v, 0, t.v.length);
- },
- hL: function () {
- return this.hZ;
- },
- reset: function () {
- this.hB = 0;
- this.eW = 0;
- for (var kc in this.ft) this.ft[kc] = null;
- K(this.gU, 0, this.v, 0, this.gU.length);
- this.eI = 0;
- K(this.fU, 0, this.X, 0, this.fU.length);
- },
- hS: function () {
- var i;
- var fs = this.X;
- var gu = new Array(64);
- for (i = 16; i < 68; i++) {
- fs[i] = this.kT(fs[i - 16] ^ fs[i - 9] ^ (this.rotate(fs[i - 3], 15))) ^ (this.rotate(fs[i - 13], 7)) ^ fs[i -
- 6];
- }
- for (i = 0; i < 64; i++) {
- gu[i] = fs[i] ^ fs[i + 4];
- }
- var ej = this.v;
- var dr = this.jJ;
- K(ej, 0, dr, 0, this.gU.length);
- var fj, fV, hI, fQ, fW;
- for (i = 0; i < 16; i++) {
- fW = this.rotate(dr[0], 12);
- fj = this.dj.parse(this.dj.parse(fW + dr[4]) + this.rotate(this.lw, i));
- fj = this.rotate(fj, 7);
- fV = fj ^ fW;
- hI = this.dj.parse(this.dj.parse(this.lu(dr[0], dr[1], dr[2]) + dr[3]) + fV) + gu[i];
- fQ = this.dj.parse(this.dj.parse(this.ky(dr[4], dr[5], dr[6]) + dr[7]) + fj) + fs[i];
- dr[3] = dr[2];
- dr[2] = this.rotate(dr[1], 9);
- dr[1] = dr[0];
- dr[0] = hI;
- dr[7] = dr[6];
- dr[6] = this.rotate(dr[5], 19);
- dr[5] = dr[4];
- dr[4] = this.ii(fQ);
- }
- for (i = 16; i < 64; i++) {
- fW = this.rotate(dr[0], 12);
- fj = this.dj.parse(this.dj.parse(fW + dr[4]) + this.rotate(this.lz, i));
- fj = this.rotate(fj, 7);
- fV = fj ^ fW;
- hI = this.dj.parse(this.dj.parse(this.kk(dr[0], dr[1], dr[2]) + dr[3]) + fV) + gu[i];
- fQ = this.dj.parse(this.dj.parse(this.jL(dr[4], dr[5], dr[6]) + dr[7]) + fj) + fs[i];
- dr[3] = dr[2];
- dr[2] = this.rotate(dr[1], 9);
- dr[1] = dr[0];
- dr[0] = hI;
- dr[7] = dr[6];
- dr[6] = this.rotate(dr[5], 19);
- dr[5] = dr[4];
- dr[4] = this.ii(fQ);
- }
- for (i = 0; i < 8; i++) {
- ej[i] ^= this.dj.parse(dr[i]);
- }
- this.eI = 0;
- K(this.fU, 0, this.X, 0, this.fU.length);
- },
- iC: function (hg, ee) {
- var n = hg[ee] << 24;
- n |= (hg[++ee] & 0xff) << 16;
- n |= (hg[++ee] & 0xff) << 8;
- n |= (hg[++ee] & 0xff);
- this.X[this.eI] = n;
- if (++this.eI == 16) {
- this.hS();
- }
- },
- ly: function (fg) {
- if (this.eI > 14) {
- this.hS();
- }
- this.X[14] = (this.ke(fg, 32));
- this.X[15] = (fg & (0xffffffff));
- },
- kP: function (n, fD, off) {
- fD[off] = this.dj.gK(this.hu(n, 24)) & 0x000000FF;
- fD[++off] = this.dj.gK(this.hu(n, 16)) & 0x000000FF;
- fD[++off] = this.dj.gK(this.hu(n, 8)) & 0x000000FF;
- fD[++off] = this.dj.gK(n) & 0x000000FF;
- },
- gN: function (lm, lv) {
- this.finish();
- for (var i = 0; i < 8; i++) {
- this.kP(this.v[i], lm, lv + i * 4);
- }
- this.reset();
- return this.hZ;
- },
- update: function (input) {
- this.ft[this.eW++] = input;
- if (this.eW == this.ft.length) {
- this.iC(this.ft, 0);
- this.eW = 0;
- }
- this.hB++;
- },
- fc: function (input, ee, length) {
- while ((this.eW != 0) && (length > 0)) {
- this.update(input[ee]);
- ee++;
- length--;
- }
- while (length > this.ft.length) {
- this.iC(input, ee);
- ee += this.ft.length;
- length -= this.ft.length;
- this.hB += this.ft.length;
- }
- while (length > 0) {
- this.update(input[ee]);
- ee++;
- length--;
- }
- },
- finish: function () {
- var fg = (this.hB << 3);
- this.update((128));
- while (this.eW != 0) this.update((0));
- this.ly(fg);
- this.hS();
- },
- rotate: function (x, n) {
- return (x << n) | (this.hu(x, (32 - n)));
- },
- ii: function (X) {
- return ((X) ^ this.rotate((X), 9) ^ this.rotate((X), 17));
- },
- kT: function (X) {
- return ((X) ^ this.rotate((X), 15) ^ this.rotate((X), 23));
- },
- lu: function (X, Y, Z) {
- return (X ^ Y ^ Z);
- },
- kk: function (X, Y, Z) {
- return ((X & Y) | (X & Z) | (Y & Z));
- },
- ky: function (X, Y, Z) {
- return (X ^ Y ^ Z);
- },
- jL: function (X, Y, Z) {
- return ((X & Y) | (~X & Z));
- },
- hu: function (number, fu) {
- if (number > this.dj.ir || number < this.dj.ki) {
- number = this.dj.parse(number);
- }
- if (number >= 0) {
- return number >> fu;
- } else {
- return (number >> fu) + (2 << ~fu);
- }
- },
- ke: function (number, fu) {
- var fR;
- var big = new L();
- big.eT(number);
- if (big.eJ() >= 0) {
- fR = big.ic(fu).hs();
- } else {
- var jm = new L();
- jm.eT(2);
- var iU = ~fu;
- var gh = '';
- if (iU < 0) {
- var jS = 64 + iU;
- for (var i = 0; i < jS; i++) {
- gh += '0';
- }
- var jE = new L();
- jE.eT(number >> fu);
- var jC = new L("10" + gh, 2);
- gh = jC.eD(10);
- var r = jC.add(jE);
- fR = r.eD(10);
- } else {
- gh = jm.shiftLeft((~fu)).hs();
- fR = (number >> fu) + gh;
- }
- }
- return fR;
- },
- jN: function (g, kz) {
- var jf = new Array(32);
- var iz = new Array(32);
- K(kz, 1, jf, 0, 32);
- K(kz, 33, iz, 0, 32);
- var iB = CommonUtils.utf8StrToHex('1234567812345678');
- var dm = iB.length * 4;
- this.update((dm >> 8 & 0x00ff));
- this.update((dm & 0x00ff));
- var ia = this.gB(iB);
- this.fc(ia, 0, ia.length);
- var it = this.gB(g.dP.a.cR().eD(16));
- var ip = this.gB(g.dP.b.cR().eD(16));
- var jl = this.gB(g.fI().cR().eD(16));
- var ie = this.gB(g.ec().cR().eD(16));
- var ig = jf;
- var iu = iz;
- this.fc(it, 0, it.length);
- this.fc(ip, 0, ip.length);
- this.fc(jl, 0, jl.length);
- this.fc(ie, 0, ie.length);
- this.fc(ig, 0, ig.length);
- this.fc(iu, 0, iu.length);
- var hX = new Array(this.hL());
- this.gN(hX, 0);
- return hX;
- },
- gB: function (jq) {
- var eN = [];
- var lp = jq.length;
- for (var i = 0; i < lp; i += 2) {
- eN.push(parseInt(jq.substr(i, 2), 16));
- }
- return eN;
- }
- };
- window.CipherMode = {
- C1C2C3: 0,
- C1C3C2: 1,
- c1c2c3: 0,
- c1c3c2: 1
- };
- function aK(eV, eC) {
- if (typeof (eV) != 'undefined' && eV === 1) {
- this.eV = CipherMode.C1C3C2;
- } else {
- this.eV = CipherMode.C1C2C3;
- }
- if (typeof (eC) != 'undefined' && CommonUtils.isHexString(eC)) {
- this.eC = eC;
- } else {
- this.eC = null;
- }
- this.kQ = new L("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF", 16);
- this.ks = new L("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC", 16);
- this.kG = new L("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93", 16);
- this.eB = new L("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123", 16);
- this.jX = new L("32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7", 16);
- this.kI = new L("BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0", 16);
- this.lK = 256;
- this.jM = new bo();
- this.gZ = new V(this.kQ, this.ks, this.kG);
- this.ha = G.hQ(this.gZ, "04" + this.jX.toString(16) + this.kI.toString(16));
- };
- aK.prototype = {
- jU: function (jo) {
- return new L(jo.fg(), this.jM).cl(jo.cv(L.ONE)).add(L.ONE);
- },
- generateKeyPair: function () {
- var eF = this.jt();
- var cZ = eF['gk'].gv();
- var jd = eF['fb'].fI().cR();
- var jn = eF['fb'].ec().cR();
- var jH = this.fN(jd, 32);
- var lj = this.fN(jn, 32);
- var dC = new Array(65);
- dC[0] = 0x04;
- K(jH, 0, dC, 1, 32);
- K(lj, 0, dC, 33, 32);
- return {
- 'gk': cZ,
- 'fb': dC
- };
- },
- kX: function () {
- var eF = this.generateKeyPair();
- var lo = eF.fb;
- var lA = eF.gk;
- return {
- 'prvkeyhex': CommonUtils.bytesToHex(lA),
- 'pubkeyhex': CommonUtils.bytesToHex(lo)
- };
- },
- jt: function (eC) {
- var iJ = this.eB;
- var gF = null;
- var iV = null;
- if (CommonUtils.isHexString(eC)) {
- gF = new L(eC, 16);
- } else {
- do {
- gF = this.jU(iJ);
- } while (gF.equals(L.ZERO) || gF.dw(iJ) >= 0);
- }
- iV = this.ha.multiply(gF);
- return {
- 'gk': gF,
- "fb": iV
- };
- },
- jR: function (cZ) {
- var hn = this.ha.multiply(new L(CommonUtils.bytesToHex(cZ), 16));
- var x = this.fN(hn.fI().cR(), 32);
- var y = this.fN(hn.ec().cR(), 32);
- var dC = new Array(65);
- dC[0] = 0x04;
- K(x, 0, dC, 1, 32);
- K(y, 0, dC, 33, 32);
- return dC;
- },
- jT: function () {
- var eF = this.jt();
- var jd = eF['fb'].fI().cR();
- var jn = eF['fb'].ec().cR();
- var hn = this.gZ.kU(jd, jn);
- eF.x1 = hn.fI().cR();
- return eF;
- },
- fN: function (kb, hH) {
- var dF = new Array(hH);
- for (var i = 0; i < dF.length; i++) {
- dF[i] = 0;
- }
- var eK = kb.gv();
- if (eK == null) {
- return null;
- }
- if (eK.length > hH) {
- K(eK, eK.length - hH, dF, 0, hH);
- } else if (eK.length == hH) {
- dF = eK;
- } else {
- K(eK, 0, dF, hH - eK.length, eK.length);
- }
- return dF;
- },
- iH: function (eU, data) {
- var loop = Math.ceil(data.length / 32);
- var eP;
- var hash = new Array(32);
- for (var i = 0; i < loop; i++) {
- eP = new T();
- eP.fc(eU, 0, eU.length);
- eP.fc(F(i + 1), 0, 4);
- eP.gN(hash, 0);
- for (var j = 0; j < hash.length && (i * 32 + j) < data.length; j++) {
- data[i * 32 + j] ^= hash[j];
- }
- }
- return 0;
- },
- iO: function (data, dC) {
- var hi = new T();
- var iK = new T().jN(this.ha, dC);
- var hO = data;
- var eQ = new Array(hi.hL());
- hi.fc(iK, 0, iK.length);
- hi.fc(hO, 0, hO.length);
- hi.gN(eQ, 0);
- return eQ;
- },
- er: function (data, cZ, bZ) {
- var dC = this.jR(cZ);
- var eQ = this.iO(data, dC);
- var iE = new L(CommonUtils.bytesToHex(cZ), 16);
- var e = new L(CommonUtils.bytesToHex(eQ), 16);
- var k = null;
- var r = null;
- var s = null;
- do {
- do {
- var ib = this.jT();
- k = ib.gk;
- r = e.add(ib.x1).cl(this.eB);
- } while (r.equals(L.ZERO) || r.add(k).equals(this.eB));
- s = iE.add(L.ONE).fZ(this.eB).multiply(k.cv(r.multiply(iE))).cl(this.eB);
- } while (s.equals(L.ZERO));
- if (typeof (bZ) != 'undefined' && bZ == true) {
- var kx = this.kd(r.gv(), s.gv());
- return kx;
- } else {
- var kO = this.fN(r, 32);
- var jI = this.fN(s, 32);
- return CommonUtils.hexToBytes(CommonUtils.bytesToHex(kO) + CommonUtils.bytesToHex(jI));
- }
- },
- ga: function (data, cB, dC, bZ) {
- var eQ = this.iO(data, dC);
- var r = null;
- var s = null;
- if (typeof (bZ) != 'undefined' && bZ == true) {
- var cN = this.le(cB);
- var hW = new Array(cN["r"].length);
- var iF = new Array(cN["s"].length);
- K(cN["r"], 0, hW, 0, cN["r"].length);
- K(cN["s"], 0, iF, 0, cN["s"].length);
- r = new L(CommonUtils.bytesToHex(hW), 16);
- s = new L(CommonUtils.bytesToHex(iF), 16);
- } else {
- var dW = CommonUtils.bytesToHex(cB);
- r = new L(dW.substring(0, 64), 16);
- s = new L(dW.substring(64), 16);
- }
- var hn = this.gZ.kR(CommonUtils.bytesToHex(dC));
- var e = new L(CommonUtils.bytesToHex(eQ), 16);
- var t = r.add(s).cl(this.eB);
- if (t.equals(L.ZERO)) return false;
- var lB = this.ha.multiply(s).add(hn.multiply(t));
- var R = e.add(lB.fI().cR()).cl(this.eB);
- return r.equals(R);
- },
- gd: function (dC, data, bZ) {
- if (dC == null || dC.length == 0 || data == null || data.length == 0) {
- return null;
- }
- var lq = G.jZ(this.gZ, dC);
- var cL = null;
- var fA = null;
- var x2 = null;
- var y2 = null;
- var ji = this.jt(this.eC);
- fA = ji['fb'];
- var iS = lq.multiply(ji['gk']);
- x2 = this.fN(iS.fI().cR(), 32);
- y2 = this.fN(iS.ec().cR(), 32);
- cL = new Array(data.length);
- K(data, 0, cL, 0, data.length);
- var eU = new Array(x2.length + y2.length);
- K(x2, 0, eU, 0, x2.length);
- K(y2, 0, eU, x2.length, y2.length);
- this.iH(eU, cL);
- var cD = new Array(32);
- var eP = new T();
- eP.fc(x2, 0, x2.length);
- eP.fc(data, 0, data.length);
- eP.fc(y2, 0, y2.length);
- eP.gN(cD, 0);
- if (typeof (bZ) != 'undefined' && bZ == true) {
- var ln = fA.fI().cR().gv();
- var kf = fA.ec().cR().gv();
- var kn = this.kZ(ln, kf, cL, cD);
- return kn;
- } else {
- var dG = this.fN(fA.fI().cR(), 32);
- var cF = this.fN(fA.ec().cR(), 32);
- var cw = new Array(97 + cL.length);
- cw[0] = 0x04;
- K(dG, 0, cw, 1, dG.length);
- K(cF, 0, cw, 1 + dG.length, cF.length);
- if (this.eV === CipherMode.C1C2C3) {
- K(cL, 0, cw, 1 + dG.length + cF.length, cL.length);
- K(cD, 0, cw, 1 + dG.length + cF.length + cL.length, cD.length);
- } else {
- K(cD, 0, cw, 1 + dG.length + cF.length, cD.length);
- K(cL, 0, cw, 1 + dG.length + cF.length + cD.length, cL.length);
- }
- return cw;
- }
- },
- ht: function (cZ, dH, bZ) {
- if (cZ == null || cZ.length == 0 || dH == null || dH.length == 0) {
- return null;
- }
- var fA = new Array(64 + 1);
- var cL = null;
- var cD = new Array(32);
- if (typeof (bZ) != 'undefined' && bZ == true) {
- var cN = this.lh(dH);
- cL = new Array(cN["cL"].length);
- for (var i = 0; i < fA.length; i++) {
- fA[i] = 0;
- }
- fA[0] = 0x04;
- if (cN["dG"].length <= 32) {
- K(cN["dG"], 0, fA, 1 + (32 - cN["dG"].length), cN["dG"].length);
- } else {
- K(cN["dG"], cN["dG"].length - 32, fA, 1, 32);
- }
- if (cN["cF"].length <= 32) {
- K(cN["cF"], 0, fA, 1 + 32 + (32 - cN["cF"].length), cN["cF"].length);
- } else {
- K(cN["cF"], cN["cF"].length - 32, fA, 1 + 32, 32);
- }
- K(cN["cL"], 0, cL, 0, cL.length);
- K(cN["cD"], 0, cD, 0, 32);
- } else {
- cL = new Array(dH.length - 97);
- K(dH, 0, fA, 0, 65);
- if (this.eV === CipherMode.C1C2C3) {
- K(dH, 65, cL, 0, dH.length - 97);
- K(dH, dH.length - 32, cD, 0, 32);
- } else {
- K(dH, 65, cD, 0, 32);
- K(dH, 97, cL, 0, dH.length - 97);
- }
- }
- var lg = G.hQ(this.gZ, CommonUtils.bytesToHex(fA));
- var jc = lg.multiply(new L(CommonUtils.bytesToHex(cZ), 16));
- var x2 = this.fN(jc.fI().cR(), 32);
- var y2 = this.fN(jc.ec().cR(), 32);
- var eU = new Array(x2.length + y2.length);
- K(x2, 0, eU, 0, x2.length);
- K(y2, 0, eU, x2.length, y2.length);
- var jv = new Array(cL.length);
- K(cL, 0, jv, 0, cL.length);
- this.iH(eU, cL);
- if (co(jv, 0, cL, 0, cL.length) == 0) {
- return null;
- }
- var eP = new T();
- var hash = new Array(32);
- eP.fc(x2, 0, x2.length);
- eP.fc(cL, 0, cL.length);
- eP.fc(y2, 0, y2.length);
- eP.gN(hash, 0);
- var hT = CommonUtils.bytesToHex(cD);
- var ix = CommonUtils.bytesToHex(hash);
- if (!hT || !ix || hT != ix) {
- return null;
- }
- return cL;
- },
- kd: function (r, s) {
- var fl = r.length + s.length + 4;
- var ew = [];
- ew[0] = 0x30;
- if (fl < 0x80) {
- ew[1] = fl;
- } else {
- var fp = F(fl);
- var i = 0;
- while (fp[i] == 0 && i < fp.length) {
- i++;
- }
- ew[1] = 0x80 | (fp.length - i);
- for (var j = 2; i < fp.length; i++, j++) {
- ew[j] = fp[i];
- }
- }
- var bZ = new Array(fl + ew.length);
- var cY = 0;
- K(ew, 0, bZ, 0, ew.length);
- cY += ew.length;
- bZ[cY++] = 0x02;
- bZ[cY++] = r.length;
- K(r, 0, bZ, cY, r.length);
- cY += r.length;
- bZ[cY++] = 0x02;
- bZ[cY++] = s.length;
- K(s, 0, bZ, cY, s.length);
- cY += s.length;
- return bZ;
- },
- kZ: function (dG, cF, cL, cD) {
- var fJ = cL.length;
- var dS = [];
- if (fJ < 0x80) {
- dS[0] = 0x04;
- dS[1] = fJ;
- } else {
- dS[0] = 0x04;
- var gs = F(fJ);
- var i = 0;
- while (gs[i] == 0 && i < gs.length) {
- i++;
- }
- dS[1] = 0x80 | (gs.length - i);
- for (var j = 2; i < gs.length; i++, j++) {
- dS[j] = gs[i];
- }
- }
- var fl = dG.length + cF.length + cL.length + cD.length + 6 + dS.length;
- var ew = [];
- ew[0] = 0x30;
- if (fl < 0x80) {
- ew[1] = fl;
- } else {
- var fp = F(fl);
- var i = 0;
- while (fp[i] == 0 && i < fp.length) {
- i++;
- }
- ew[1] = 0x80 | (fp.length - i);
- for (var j = 2; i < fp.length; i++, j++) {
- ew[j] = fp[i];
- }
- }
- var bZ = new Array(fl + ew.length);
- var cY = 0;
- K(ew, 0, bZ, 0, ew.length);
- cY += ew.length;
- bZ[cY++] = 0x02;
- bZ[cY++] = dG.length;
- K(dG, 0, bZ, cY, dG.length);
- cY += dG.length;
- bZ[cY++] = 0x02;
- bZ[cY++] = cF.length;
- K(cF, 0, bZ, cY, cF.length);
- cY += cF.length;
- bZ[cY++] = 0x04;
- bZ[cY++] = cD.length;
- K(cD, 0, bZ, cY, cD.length);
- cY += cD.length;
- K(dS, 0, bZ, cY, dS.length);
- cY += dS.length;
- K(cL, 0, bZ, cY, cL.length);
- return bZ;
- },
- le: function (bZ) {
- var pos = 0;
- if (bZ[pos++] != 0x30) {
- return null;
- }
- if ((bZ[pos] & 0xFF) <= 0x7F) {
- pos++;
- } else {
- pos += (bZ[pos] & 0x7F) + 1;
- }
- pos++;
- var fX = bZ[pos];
- var r = new Array(fX);
- K(bZ, ++pos, r, 0, fX);
- pos += fX;
- pos++;
- var he = bZ[pos];
- var s = new Array(he);
- K(bZ, ++pos, s, 0, he);
- pos += he;
- return {
- 'r': r,
- "s": s
- };
- },
- lh: function (bZ) {
- var pos = 0;
- if (bZ[pos++] != 0x30) {
- return null;
- }
- if ((bZ[pos] & 0xFF) <= 0x7F) {
- pos++;
- } else {
- pos += (bZ[pos] & 0x7F) + 1;
- }
- pos++;
- var jk = bZ[pos];
- var dG = new Array(jk);
- K(bZ, ++pos, dG, 0, jk);
- pos += jk;
- pos++;
- var iX = bZ[pos];
- var cF = new Array(iX);
- K(bZ, ++pos, cF, 0, iX);
- pos += iX;
- pos++;
- var jD = bZ[pos];
- var cD = new Array(jD);
- K(bZ, ++pos, cD, 0, jD);
- pos += jD;
- pos++;
- var fJ = 0;
- if ((bZ[pos] & 0xFF) <= 0x7F) {
- fJ = bZ[pos] & 0xFF;
- } else {
- for (var i = 0, j = (bZ[pos] & 0x7F) - 1; i < (bZ[pos] & 0x7F); i++, j--) {
- fJ = fJ | ((bZ[pos + i + 1] & 0xFF) << (j * 8));
- }
- pos += (bZ[pos] & 0x7F);
- }
- var cL = new Array(fJ);
- K(bZ, ++pos, cL, 0, fJ);
- pos += fJ;
- return {
- 'dG': dG,
- "cF": cF,
- "cL": cL,
- "cD": cD
- };
- }
- };
- function bL() { };
- bL.prototype = {
- source: function (source) {
- if (!source) {
- dB.error("source is empty!");
- return false;
- } else {
- return true;
- }
- },
- fd: function (eS) {
- if (typeof (eS) == 'undefined') {
- dB.error("eS type undefined!");
- } else if (eS instanceof Array) {
- eS = CommonUtils.bytesToHex(eS);
- }
- if (this.ge(eS, "04") && eS.length == 130) {
- return true;
- } else {
- dB.error("eS length error!");
- return false;
- }
- },
- fo: function (fM) {
- if (typeof (fM) == 'undefined') {
- dB.error("fM type undefined!");
- } else if (fM instanceof Array) {
- fM = CommonUtils.bytesToHex(fM);
- }
- if (fM.length % 2 == 0) {
- return true;
- } else {
- dB.error("fM length error!");
- return false;
- }
- },
- gp: function (cw) {
- if (typeof (cw) == 'undefined') {
- dB.error("cw type undefined!");
- } else if (cw instanceof Array) {
- cw = CommonUtils.bytesToHex(cw);
- }
- if (this.ge(cw, "04") && cw.length % 2 == 0 && cw.length > 194) {
- return true;
- } else if (this.ge(cw, "30") && cw.length % 2 == 0 && cw.length > 216) {
- return true;
- } else {
- dB.error("cw format jw length error!");
- return false;
- }
- },
- fP: function (er) {
- if (typeof (er) == 'undefined') {
- dB.error("er type undefined!");
- } else if (er instanceof Array) {
- er = CommonUtils.bytesToHex(er);
- }
- if (er.length == 128) {
- return true;
- } else if (this.ge(er, "30") && er.length % 2 == 0) {
- return true;
- } else {
- dB.error("er format jw length error!");
- return false;
- }
- },
- fF: function (key) {
- if (typeof (key) == 'undefined') {
- dB.error("key type undefined!");
- } else if (key instanceof Array) {
- key = CommonUtils.bytesToHex(key);
- }
- if (key.length == 32) {
- return true;
- } else {
- dB.error("key length error!");
- return false;
- }
- },
- hj: function (cd) {
- if (typeof (cd) == 'undefined') {
- dB.error("cd type undefined!");
- } else if (cd instanceof Array) {
- cd = CommonUtils.bytesToHex(cd);
- }
- if (cd.length == 32) {
- return true;
- } else {
- dB.error("cd length error!");
- return false;
- }
- },
- hd: function (cw) {
- if (typeof (cw) == 'undefined') {
- dB.error("cw type undefined!");
- } else if (cw instanceof Array) {
- cw = CommonUtils.bytesToHex(cw);
- }
- if (cw && cw.length % 16 == 0) {
- return true;
- } else {
- dB.error("cw format jw length error!");
- return false;
- }
- },
- ge: function (fL, start) {
- var reg = new RegExp("^" + start);
- return reg.test(fL);
- }
- };
- function Sm2Utils(eV, eC) {
- if (typeof (eV) != 'undefined') {
- this.eV = eV;
- } else {
- this.eV = CipherMode.C1C2C3;
- }
- if (typeof (eC) != 'undefined' && CommonUtils.isHexString(eC)) {
- this.eC = eC;
- } else {
- this.eC = null;
- }
- this.cw = new aK(this.eV, this.eC);
- this.smValidate = new bL();
- };
- Sm2Utils.prototype = {
- generateKeyPair: function () {
- return this.cw.kX();
- },
- getPublicKey: function (kL) {
- var cZ = CommonUtils.hexToBytes(kL);
- var dC = this.cw.jR(cZ);
- return CommonUtils.bytesToHex(dC);
- },
- encryptFromText: function (cV, cb) {
- if (!this.smValidate.fd(cV)) {
- return null;
- }
- if (!this.smValidate.source(cb)) {
- return null;
- }
- var dC = CommonUtils.hexToBytes(cV);
- var cu = CommonUtils.utf8StrToBytes(cb);
- var dH = this.cw.gd(dC, cu, false);
- return CommonUtils.bytesToHex(dH);
- },
- decryptToText: function (du, cE) {
- if (!this.smValidate.fo(du)) {
- return null;
- }
- if (!this.smValidate.gp(cE)) {
- return null;
- }
- var cZ = CommonUtils.hexToBytes(du);
- var dH = CommonUtils.hexToBytes(cE);
- var cu = this.cw.ht(cZ, dH, false);
- return CommonUtils.bytesToUtf8Str(cu);
- },
- encryptFromHex: function (cV, dO) {
- if (!this.smValidate.fd(cV)) {
- return null;
- }
- if (!this.smValidate.source(dO)) {
- return null;
- }
- var dC = CommonUtils.hexToBytes(cV);
- var cu = CommonUtils.hexToBytes(dO);
- var dH = this.cw.gd(dC, cu, false);
- return CommonUtils.bytesToHex(dH);
- },
- decryptToHex: function (du, cE) {
- if (!this.smValidate.fo(du)) {
- return null;
- }
- if (!this.smValidate.gp(cE)) {
- return null;
- }
- var cZ = CommonUtils.hexToBytes(du);
- var dH = CommonUtils.hexToBytes(cE);
- var cu = this.cw.ht(cZ, dH, false);
- return CommonUtils.bytesToHex(cu);
- },
- encryptFromData: function (dC, cu) {
- if (!this.smValidate.fd(dC)) {
- return null;
- }
- if (!this.smValidate.source(cu)) {
- return null;
- }
- return this.cw.gd(dC, cu, false);
- },
- decryptToData: function (cZ, dH) {
- if (!this.smValidate.fo(cZ)) {
- return null;
- }
- if (!this.smValidate.gp(dH)) {
- return null;
- }
- return this.cw.ht(cZ, dH, false);
- },
- encryptASN1FromText: function (cV, cb) {
- if (!this.smValidate.fd(cV)) {
- return null;
- }
- if (!this.smValidate.source(cb)) {
- return null;
- }
- var dC = CommonUtils.hexToBytes(cV);
- var cu = CommonUtils.utf8StrToBytes(cb);
- var dH = this.cw.gd(dC, cu, true);
- return CommonUtils.bytesToHex(dH);
- },
- decryptASN1ToText: function (du, cE) {
- if (!this.smValidate.fo(du)) {
- return null;
- }
- if (!this.smValidate.gp(cE)) {
- return null;
- }
- var cZ = CommonUtils.hexToBytes(du);
- var dH = CommonUtils.hexToBytes(cE);
- var cu = this.cw.ht(cZ, dH, true);
- return CommonUtils.bytesToUtf8Str(cu);
- },
- encryptASN1FromHex: function (cV, dO) {
- if (!this.smValidate.fd(cV)) {
- return null;
- }
- if (!this.smValidate.source(dO)) {
- return null;
- }
- var dC = CommonUtils.hexToBytes(cV);
- var cu = CommonUtils.hexToBytes(dO);
- var dH = this.cw.gd(dC, cu, true);
- return CommonUtils.bytesToHex(dH);
- },
- decryptASN1ToHex: function (du, cE) {
- if (!this.smValidate.fo(du)) {
- return null;
- }
- if (!this.smValidate.gp(cE)) {
- return null;
- }
- var cZ = CommonUtils.hexToBytes(du);
- var dH = CommonUtils.hexToBytes(cE);
- var cu = this.cw.ht(cZ, dH, true);
- return CommonUtils.bytesToHex(cu);
- },
- encryptASN1FromData: function (dC, cu) {
- if (!this.smValidate.fd(dC)) {
- return null;
- }
- if (!this.smValidate.source(cu)) {
- return null;
- }
- return this.cw.gd(dC, cu, true);
- },
- decryptASN1ToData: function (cZ, dH) {
- if (!this.smValidate.fo(cZ)) {
- return null;
- }
- if (!this.smValidate.gp(dH)) {
- return null;
- }
- return this.cw.ht(cZ, dH, true);
- },
- signFromText: function (du, cb) {
- if (!this.smValidate.fo(du)) {
- return null;
- }
- if (!this.smValidate.source(cb)) {
- return null;
- }
- var cZ = CommonUtils.hexToBytes(du);
- var cu = CommonUtils.utf8StrToBytes(cb);
- var cB = this.cw.er(cu, cZ, false);
- return CommonUtils.bytesToHex(cB);
- },
- verifySignFromText: function (cV, cb, dW) {
- if (!this.smValidate.fd(cV)) {
- return null;
- }
- if (!this.smValidate.source(cb)) {
- return null;
- }
- if (!this.smValidate.fP(dW)) {
- return null;
- }
- var dC = CommonUtils.hexToBytes(cV);
- var cu = CommonUtils.utf8StrToBytes(cb);
- var cB = CommonUtils.hexToBytes(dW);
- return this.cw.ga(cu, cB, dC, false);
- },
- signFromHex: function (du, dO) {
- if (!this.smValidate.fo(du)) {
- return null;
- }
- if (!this.smValidate.source(dO)) {
- return null;
- }
- var cZ = CommonUtils.hexToBytes(du);
- var cu = CommonUtils.hexToBytes(dO);
- var cB = this.cw.er(cu, cZ, false);
- return CommonUtils.bytesToHex(cB);
- },
- verifySignFromHex: function (cV, dO, dW) {
- if (!this.smValidate.fd(cV)) {
- return null;
- }
- if (!this.smValidate.source(dO)) {
- return null;
- }
- if (!this.smValidate.fP(dW)) {
- return null;
- }
- var dC = CommonUtils.hexToBytes(cV);
- var cu = CommonUtils.hexToBytes(dO);
- var cB = CommonUtils.hexToBytes(dW);
- return this.cw.ga(cu, cB, dC, false);
- },
- signFromData: function (cZ, cu) {
- if (!this.smValidate.fo(cZ)) {
- return null;
- }
- if (!this.smValidate.source(cu)) {
- return null;
- }
- return this.cw.er(cu, cZ, false);
- },
- verifySignFromData: function (dC, cu, cB) {
- if (!this.smValidate.fd(dC)) {
- return null;
- }
- if (!this.smValidate.source(cu)) {
- return null;
- }
- if (!this.smValidate.fP(cB)) {
- return null;
- }
- return this.cw.ga(cu, cB, dC, false);
- },
- signASN1FromText: function (du, cb) {
- if (!this.smValidate.fo(du)) {
- return null;
- }
- if (!this.smValidate.source(cb)) {
- return null;
- }
- var cZ = CommonUtils.hexToBytes(du);
- var cu = CommonUtils.utf8StrToBytes(cb);
- var cB = this.cw.er(cu, cZ, true);
- return CommonUtils.bytesToHex(cB);
- },
- verifySignASN1FromText: function (cV, cb, dW) {
- if (!this.smValidate.fd(cV)) {
- return null;
- }
- if (!this.smValidate.source(cb)) {
- return null;
- }
- if (!this.smValidate.fP(dW)) {
- return null;
- }
- var dC = CommonUtils.hexToBytes(cV);
- var cu = CommonUtils.utf8StrToBytes(cb);
- var cB = CommonUtils.hexToBytes(dW);
- return this.cw.ga(cu, cB, dC, true);
- },
- signASN1FromHex: function (du, dO) {
- if (!this.smValidate.fo(du)) {
- return null;
- }
- if (!this.smValidate.source(dO)) {
- return null;
- }
- var cZ = CommonUtils.hexToBytes(du);
- var cu = CommonUtils.hexToBytes(dO);
- var cB = this.cw.er(cu, cZ, true);
- return CommonUtils.bytesToHex(cB);
- },
- verifySignASN1FromHex: function (cV, dO, dW) {
- if (!this.smValidate.fd(cV)) {
- return null;
- }
- if (!this.smValidate.source(dO)) {
- return null;
- }
- if (!this.smValidate.fP(dW)) {
- return null;
- }
- var dC = CommonUtils.hexToBytes(cV);
- var cu = CommonUtils.hexToBytes(dO);
- var cB = CommonUtils.hexToBytes(dW);
- return this.cw.ga(cu, cB, dC, true);
- },
- signASN1FromData: function (cZ, cu) {
- if (!this.smValidate.fo(cZ)) {
- return null;
- }
- if (!this.smValidate.source(cu)) {
- return null;
- }
- return this.cw.er(cu, cZ, true);
- },
- verifySignASN1FromData: function (dC, cu, cB) {
- if (!this.smValidate.fd(dC)) {
- return null;
- }
- if (!this.smValidate.source(cu)) {
- return null;
- }
- if (!this.smValidate.fP(cB)) {
- return null;
- }
- return this.cw.ga(cu, cB, dC, true);
- }
- };
- var Sm3Utils = {
- smValidate: new bL(),
- encryptFromText: function (cb) {
- if (!this.smValidate.source(cb)) {
- return null;
- }
- var cu = CommonUtils.utf8StrToBytes(cb);
- var eQ = this.encryptFromData(cu);
- return CommonUtils.bytesToHex(eQ);
- },
- encryptFromHex: function (dO) {
- if (!this.smValidate.source(dO)) {
- return null;
- }
- var cu = CommonUtils.hexToBytes(dO);
- var eQ = this.encryptFromData(cu);
- return CommonUtils.bytesToHex(eQ);
- },
- encryptFromData: function (cu) {
- if (!this.smValidate.source(cu)) {
- return null;
- }
- var eQ = new Array(32);
- var jy = new T();
- jy.fc(cu, 0, cu.length);
- jy.gN(eQ, 0);
- return eQ;
- }
- };
- var Sm4Utils = {
- ECB: {
- smValidate: new bL(),
- encryptFromText: function (cb, dz) {
- if (!this.smValidate.source(cb)) {
- return null;
- }
- if (!this.smValidate.fF(dz)) {
- return null;
- }
- var cK = CommonUtils.hexToBytes(dz);
- var cu = CommonUtils.utf8StrToBytes(cb);
- var dH = this.encryptFromData(cu, cK);
- return CommonUtils.bytesToHex(dH);
- },
- encryptFromHex: function (dO, dz) {
- if (!this.smValidate.source(dO)) {
- return null;
- }
- if (!this.smValidate.fF(dz)) {
- return null;
- }
- var cK = CommonUtils.hexToBytes(dz);
- var cu = CommonUtils.hexToBytes(dO);
- var dH = this.encryptFromData(cu, cK);
- return CommonUtils.bytesToHex(dH);
- },
- encryptFromData: function (cu, cK) {
- if (!this.smValidate.source(cu)) {
- return null;
- }
- if (!this.smValidate.fF(cK)) {
- return null;
- }
- try {
- var dV = new aP();
- return dV.lk(cu, cK);
- } catch (e) {
- dB.error(e);
- return null;
- }
- },
- decryptToText: function (cE, dz) {
- if (!this.smValidate.hd(cE)) {
- return null;
- }
- if (!this.smValidate.fF(dz)) {
- return null;
- }
- var cK = CommonUtils.hexToBytes(dz);
- var dH = CommonUtils.hexToBytes(cE);
- var cu = this.decryptToData(dH, cK);
- return CommonUtils.bytesToUtf8Str(cu);
- },
- decryptToHex: function (cE, dz) {
- if (!this.smValidate.hd(cE)) {
- return null;
- }
- if (!this.smValidate.fF(dz)) {
- return null;
- }
- var cK = CommonUtils.hexToBytes(dz);
- var dH = CommonUtils.hexToBytes(cE);
- var cu = this.decryptToData(dH, cK);
- return CommonUtils.bytesToHex(cu);
- },
- decryptToData: function (dH, cK) {
- if (!this.smValidate.hd(dH)) {
- return null;
- }
- if (!this.smValidate.fF(cK)) {
- return null;
- }
- try {
- var dV = new aP();
- return dV.kY(dH, cK);
- } catch (e) {
- dB.error(e);
- return null;
- }
- }
- },
- CBC: {
- smValidate: new bL(),
- encryptFromText: function (cb, dz, dZ) {
- if (!this.smValidate.source(cb)) {
- return null;
- }
- if (!this.smValidate.fF(dz)) {
- return null;
- }
- if (!this.smValidate.hj(dZ)) {
- return null;
- }
- var cK = CommonUtils.hexToBytes(dz);
- var fq = CommonUtils.hexToBytes(dZ);
- var cu = CommonUtils.utf8StrToBytes(cb);
- var dH = this.encryptFromData(cu, cK, fq);
- return CommonUtils.bytesToHex(dH);
- },
- encryptFromHex: function (dO, dz, dZ) {
- if (!this.smValidate.source(dO)) {
- return null;
- }
- if (!this.smValidate.fF(dz)) {
- return null;
- }
- if (!this.smValidate.hj(dZ)) {
- return null;
- }
- var cK = CommonUtils.hexToBytes(dz);
- var fq = CommonUtils.hexToBytes(dZ);
- var cu = CommonUtils.hexToBytes(dO);
- var dH = this.encryptFromData(cu, cK, fq);
- return CommonUtils.bytesToHex(dH);
- },
- encryptFromData: function (cu, cK, fq) {
- if (!this.smValidate.source(cu)) {
- return null;
- }
- if (!this.smValidate.fF(cK)) {
- return null;
- }
- if (!this.smValidate.hj(fq)) {
- return null;
- }
- try {
- var dV = new aP();
- return dV.ll(cu, cK, fq);
- } catch (e) {
- dB.error(e);
- return null;
- }
- },
- decryptToText: function (cE, dz, dZ) {
- if (!this.smValidate.hd(cE)) {
- return null;
- }
- if (!this.smValidate.fF(dz)) {
- return null;
- }
- if (!this.smValidate.hj(dZ)) {
- return null;
- }
- var cK = CommonUtils.hexToBytes(dz);
- var fq = CommonUtils.hexToBytes(dZ);
- var dH = CommonUtils.hexToBytes(cE);
- var cu = this.decryptToData(dH, cK, fq);
- return CommonUtils.bytesToUtf8Str(cu);
- },
- decryptToHex: function (cE, dz, dZ) {
- if (!this.smValidate.hd(cE)) {
- return null;
- }
- if (!this.smValidate.fF(dz)) {
- return null;
- }
- if (!this.smValidate.hj(dZ)) {
- return null;
- }
- var cK = CommonUtils.hexToBytes(dz);
- var fq = CommonUtils.hexToBytes(dZ);
- var dH = CommonUtils.hexToBytes(cE);
- var cu = this.decryptToData(dH, cK, fq);
- return CommonUtils.bytesToHex(cu);
- },
- decryptToData: function (dH, cK, fq) {
- if (!this.smValidate.hd(dH)) {
- return null;
- }
- if (!this.smValidate.fF(cK)) {
- return null;
- }
- if (!this.smValidate.hj(fq)) {
- return null;
- }
- try {
- var dV = new aP();
- return dV.kD(dH, cK, fq);
- } catch (e) {
- dB.error(e);
- return null;
- }
- }
- }
- };
- // export {
- // Sm3Utils,
- // Sm4Utils,
- // Sm2Utils
- // }
- Sm3Utils,
- Sm4Utils,
- Sm2Utils
|