entry-SmCrypto-2.9.js 86 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632
  1. /********************************************/
  2. /* */
  3. /* Copyright (c) 2020 Aostar */
  4. /* @author bgu */
  5. /* @version 2.9 */
  6. /* */
  7. /********************************************/
  8. function K(src, ei, ed, eo, dm) {
  9. var gX = dm;
  10. if (ei + dm > src.length && eo + dm <= ed.length) {
  11. gX = src.length - ei;
  12. } else if (eo + dm > ed.length && ei + dm <= src.length) {
  13. gX = ed.length - eo;
  14. } else if (ei + dm <= src.length && eo + dm <= ed.length) {
  15. gX = dm;
  16. } else if (ed.length < src.length) {
  17. gX = ed.length - eo;
  18. } else {
  19. gX = src.length - eo;
  20. }
  21. for (var i = 0; i < gX; i++) {
  22. ed[i + eo] = src[i + ei];
  23. }
  24. };
  25. function co(jr, ei, ij, eo, dm) {
  26. if (jr.length - ei < dm) {
  27. return -1;
  28. }
  29. if (ij.length - eo < dm) {
  30. return -1;
  31. }
  32. for (var i = 0; i < dm; i++) {
  33. if (jr[ei++] != ij[eo++]) {
  34. return -1;
  35. }
  36. }
  37. return 0;
  38. };
  39. function F(hA) {
  40. return new Array((hA >> 24) & 0x000000FF, (hA >> 16) & 0x000000FF, (hA >> 8) & 0x000000FF, (hA) & 0x000000FF);
  41. };
  42. function ap(gL) {
  43. var b = new Array(gL.length * 4);
  44. for (var i = 0; i < gL.length; i++) {
  45. K(F(gL[i]), 0, b, i * 4, 4);
  46. }
  47. return b;
  48. };
  49. function bB(b, pos) {
  50. if (pos + 3 < b.length) {
  51. return ((b[pos]) << 24) | ((b[pos + 1]) << 16) | ((b[pos + 2]) << 8) | ((b[pos + 3]));
  52. } else if (pos + 2 < b.length) {
  53. return ((b[pos + 1]) << 16) | ((b[pos + 2]) << 8) | ((b[pos + 3]));
  54. } else if (pos + 1 < b.length) {
  55. return ((b[pos]) << 8) | ((b[pos + 1]));
  56. } else {
  57. return ((b[pos]));
  58. }
  59. };
  60. function aI(b) {
  61. var kF = Math.ceil(b.length / 4);
  62. var out = new Array(kF);
  63. for (var i = 0; i < b.length; i++) {
  64. b[i] = b[i] & 0xFF;
  65. }
  66. for (var i = 0; i < out.length; i++) {
  67. out[i] = bB(b, i * 4);
  68. }
  69. return out;
  70. };
  71. var CommonUtils = {
  72. bytesToHex: function (ev) {
  73. var dm = ev.length;
  74. var dg = new Array(dm * 2);
  75. var ju = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
  76. for (var i = 0, j = 0; i < dm; i++, j++) {
  77. dg[j] = ju[(ev[i] & 0xFF) >> 4];
  78. dg[++j] = ju[(ev[i] & 0x0F)];
  79. }
  80. return dg.join('');
  81. },
  82. hexToBytes: function (hC) {
  83. if (hC == null || hC == '') {
  84. return null;
  85. }
  86. if (hC.length % 2 != 0) {
  87. return null;
  88. }
  89. var il = hC.length / 2;
  90. var dg = this.jY(hC);
  91. var eG = new Array(il);
  92. for (var i = 0; i < il; i++) {
  93. if (dg[2 * i] >= 0x30 && dg[2 * i] <= 0x39) {
  94. eG[i] = ((dg[2 * i] - 0x30) << 4);
  95. } else if (dg[2 * i] >= 0x41 && dg[2 * i] <= 0x46) {
  96. eG[i] = ((dg[2 * i] - 0x41 + 10) << 4);
  97. } else if (dg[2 * i] >= 0x61 && dg[2 * i] <= 0x66) {
  98. eG[i] = ((dg[2 * i] - 0x61 + 10) << 4);
  99. } else {
  100. return null;
  101. }
  102. if (dg[2 * i + 1] >= 0x30 && dg[2 * i + 1] <= 0x39) {
  103. eG[i] = (eG[i] | (dg[2 * i + 1] - 0x30));
  104. } else if (dg[2 * i + 1] >= 0x41 && dg[2 * i + 1] <= 0x46) {
  105. eG[i] = (eG[i] | (dg[2 * i + 1] - 0x41 + 10));
  106. } else if (dg[2 * i + 1] >= 0x61 && dg[2 * i + 1] <= 0x66) {
  107. eG[i] = (eG[i] | (dg[2 * i + 1] - 0x61 + 10));
  108. } else {
  109. return null;
  110. }
  111. }
  112. return eG;
  113. },
  114. utf8StrToHex: function (fT) {
  115. var iG = encodeURIComponent(fT);
  116. var gA = unescape(iG);
  117. var iY = gA.length;
  118. var eN = [];
  119. for (var i = 0; i < iY; i++) {
  120. eN[i] = (gA.charCodeAt(i).toString(16)).toUpperCase();
  121. }
  122. return eN.join('');
  123. },
  124. utf8StrToBytes: function (fT) {
  125. var iG = encodeURIComponent(fT);
  126. var gA = unescape(iG);
  127. var iY = gA.length;
  128. var eN = [];
  129. for (var i = 0; i < iY; i++) {
  130. eN[i] = gA.charCodeAt(i);
  131. }
  132. return eN;
  133. },
  134. hexToUtf8Str: function (fT) {
  135. var gn = CommonUtils.hexToBytes(fT);
  136. var gE = [];
  137. for (var i = 0; i < gn.length; i++) {
  138. gE.push(String.fromCharCode(gn[i]));
  139. }
  140. return decodeURIComponent(escape(gE.join('')));
  141. },
  142. bytesToUtf8Str: function (kt) {
  143. var gn = kt;
  144. var gE = [];
  145. for (var i = 0; i < gn.length; i++) {
  146. gE.push(String.fromCharCode(gn[i]));
  147. }
  148. return decodeURIComponent(escape(gE.join('')));
  149. },
  150. jY: function (hN) {
  151. var iW = new Array(hN.length);
  152. for (var i = 0; i < hN.length; i++) {
  153. iW[i] = hN.charCodeAt(i);
  154. }
  155. return iW;
  156. },
  157. isHexString: function (fL) {
  158. var pattern = new RegExp(/^[A-Za-z0-9]+$/);
  159. return fL != null && pattern.test(fL);
  160. },
  161. randomWord: function (dm) {
  162. var fL = "";
  163. var hF = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
  164. 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E',
  165. 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  166. '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_'
  167. ];
  168. for (var i = 0; i < dm; i++) {
  169. pos = Math.round(Math.random() * (hF.length - 1));
  170. fL += hF[pos];
  171. }
  172. return fL;
  173. },
  174. randomHex: function (dm) {
  175. var fL = "";
  176. var hF = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
  177. for (var i = 0; i < dm; i++) {
  178. pos = Math.round(Math.random() * (hF.length - 1));
  179. fL += hF[pos];
  180. }
  181. return fL;
  182. },
  183. equals: function (eH, fv) {
  184. for (fK in eH) {
  185. if (eH.hasOwnProperty(fK) != fv.hasOwnProperty(fK)) {
  186. return false;
  187. } else if (typeof eH[fK] != typeof fv[fK]) {
  188. return false;
  189. }
  190. }
  191. for (fK in fv) {
  192. if (eH.hasOwnProperty(fK) != fv.hasOwnProperty(fK)) {
  193. return false;
  194. } else if (typeof eH[fK] != typeof fv[fK]) {
  195. return false;
  196. }
  197. if (!eH.hasOwnProperty(fK)) continue;
  198. if (eH[fK] instanceof Array && fv[fK] instanceof Array) {
  199. if (!eH[fK].equals(fv[fK])) return false;
  200. } else if (eH[fK] instanceof Object && fv[fK] instanceof Object) {
  201. if (!eH[fK].equals(fv[fK])) return false;
  202. } else if (eH[fK] != fv[fK]) {
  203. return false;
  204. }
  205. }
  206. return true;
  207. },
  208. v_ltd: function () {
  209. var word = new jW.mG.mP.gD([-442786843, -1214389064, -1377332043, -443502618, -1735465320, -1612398687, -
  210. 427708442, -1971263844, -1343841143, -375811867, -2052266609, -1207959552
  211. ]);
  212. var text = word.toString(jW.ey.nj);
  213. return text;
  214. }
  215. };
  216. var ep;
  217. var kK = 0xdeadbeefcafe;
  218. var iL = ((kK & 0xffffff) == 0xefcafe);
  219. function L(a, b, c) {
  220. if (a != null)
  221. if ("number" == typeof a) this.iM(a, b, c);
  222. else if (b == null && "string" != typeof a) this.hK(a, 256);
  223. else this.hK(a, b);
  224. };
  225. function C() {
  226. return new L(null);
  227. };
  228. function al(i, x, w, j, c, n) {
  229. while (--n >= 0) {
  230. var v = x * this[i++] + w[j] + c;
  231. c = Math.floor(v / 0x4000000);
  232. w[j++] = v & 0x3ffffff;
  233. }
  234. return c;
  235. };
  236. function bD(i, x, w, j, c, n) {
  237. var gw = x & 0x7fff,
  238. gl = x >> 15;
  239. while (--n >= 0) {
  240. var l = this[i] & 0x7fff;
  241. var h = this[i++] >> 15;
  242. var m = gl * l + h * gw;
  243. l = gw * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);
  244. c = (l >>> 30) + (m >>> 15) + gl * h + (c >>> 30);
  245. w[j++] = l & 0x3fffffff;
  246. }
  247. return c;
  248. };
  249. function dK(i, x, w, j, c, n) {
  250. var gw = x & 0x3fff,
  251. gl = x >> 14;
  252. while (--n >= 0) {
  253. var l = this[i] & 0x3fff;
  254. var h = this[i++] >> 14;
  255. var m = gl * l + h * gw;
  256. l = gw * l + ((m & 0x3fff) << 14) + w[j] + c;
  257. c = (l >> 28) + (m >> 14) + gl * h;
  258. w[j++] = l & 0xfffffff;
  259. }
  260. return c;
  261. };
  262. if (iL && (navigator.appName == "Microsoft Internet Explorer")) {
  263. L.prototype.eZ = bD;
  264. ep = 30;
  265. } else if (iL && (navigator.appName != "Netscape")) {
  266. L.prototype.eZ = al;
  267. ep = 26;
  268. } else {
  269. L.prototype.eZ = dK;
  270. ep = 28;
  271. }
  272. L.prototype.ct = ep;
  273. L.prototype.fi = ((1 << ep) - 1);
  274. L.prototype.ez = (1 << ep);
  275. var im = 52;
  276. L.prototype.ku = Math.pow(2, im);
  277. L.prototype.iR = im - ep;
  278. L.prototype.io = 2 * ep - im;
  279. var jV = "0123456789abcdefghijklmnopqrstuvwxyz";
  280. var gQ = new Array();
  281. var gr = "0".charCodeAt(0);
  282. for (var ej = 0; ej <= 9; ++ej) gQ[gr++] = ej;
  283. gr = "a".charCodeAt(0);
  284. for (var ej = 10; ej < 36; ++ej) gQ[gr++] = ej;
  285. gr = "A".charCodeAt(0);
  286. for (var ej = 10; ej < 36; ++ej) gQ[gr++] = ej;
  287. function bk(n) {
  288. return jV.charAt(n);
  289. };
  290. function bw(s, i) {
  291. var c = gQ[s.charCodeAt(i)];
  292. return (c == null) ? -1 : c;
  293. };
  294. function dQ(r) {
  295. for (var i = this.t - 1; i >= 0; --i) r[i] = this[i];
  296. r.t = this.t;
  297. r.s = this.s;
  298. };
  299. function cS(x) {
  300. this.t = 1;
  301. this.s = (x < 0) ? -1 : 0;
  302. if (x > 0) this[0] = x;
  303. else if (x < -1) this[0] = x + this.ez;
  304. else this.t = 0;
  305. };
  306. function H(i) {
  307. var r = C();
  308. r.eT(i);
  309. return r;
  310. };
  311. function dc(s, b) {
  312. var k;
  313. if (b == 16) k = 4;
  314. else if (b == 8) k = 3;
  315. else if (b == 256) k = 8;
  316. else if (b == 2) k = 1;
  317. else if (b == 32) k = 5;
  318. else if (b == 4) k = 2;
  319. else {
  320. this.jP(s, b);
  321. return;
  322. }
  323. this.t = 0;
  324. this.s = 0;
  325. var i = s.length,
  326. gO = false,
  327. fr = 0;
  328. while (--i >= 0) {
  329. var x = (k == 8) ? s[i] & 0xff : bw(s, i);
  330. if (x < 0) {
  331. if (s.charAt(i) == "-") gO = true;
  332. continue;
  333. }
  334. gO = false;
  335. if (fr == 0) this[this.t++] = x;
  336. else if (fr + k > this.ct) {
  337. this[this.t - 1] |= (x & ((1 << (this.ct - fr)) - 1)) << fr;
  338. this[this.t++] = (x >> (this.ct - fr));
  339. } else this[this.t - 1] |= x << fr;
  340. fr += k;
  341. if (fr >= this.ct) fr -= this.ct;
  342. }
  343. if (k == 8 && (s[0] & 0x80) != 0) {
  344. this.s = -1;
  345. if (fr > 0) this[this.t - 1] |= ((1 << (this.ct - fr)) - 1) << fr;
  346. }
  347. this.ff();
  348. if (gO) L.ZERO.cp(this, this);
  349. };
  350. function cf() {
  351. var c = this.s & this.fi;
  352. while (this.t > 0 && this[this.t - 1] == c) --this.t;
  353. };
  354. function aH(b) {
  355. if (this.s < 0) return "-" + this.el().toString(b);
  356. var k;
  357. if (b == 16) k = 4;
  358. else if (b == 8) k = 3;
  359. else if (b == 2) k = 1;
  360. else if (b == 32) k = 5;
  361. else if (b == 4) k = 2;
  362. else return this.eD(b);
  363. var hx = (1 << k) - 1,
  364. d, m = false,
  365. r = "",
  366. i = this.t;
  367. var p = this.ct - (i * this.ct) % k;
  368. if (i-- > 0) {
  369. if (p < this.ct && (d = this[i] >> p) > 0) {
  370. m = true;
  371. r = bk(d);
  372. }
  373. while (i >= 0) {
  374. if (p < k) {
  375. d = (this[i] & ((1 << p) - 1)) << (k - p);
  376. d |= this[--i] >> (p += this.ct - k);
  377. } else {
  378. d = (this[i] >> (p -= k)) & hx;
  379. if (p <= 0) {
  380. p += this.ct;
  381. --i;
  382. }
  383. }
  384. if (d > 0) m = true;
  385. if (m) r += bk(d);
  386. }
  387. }
  388. return m ? r : "0";
  389. };
  390. function aL() {
  391. var r = C();
  392. L.ZERO.cp(this, r);
  393. return r;
  394. };
  395. function cn() {
  396. return (this.s < 0) ? this.el() : this;
  397. };
  398. function aD(a) {
  399. var r = this.s - a.s;
  400. if (r != 0) return r;
  401. var i = this.t;
  402. r = i - a.t;
  403. if (r != 0) return (this.s < 0) ? -r : r;
  404. while (--i >= 0)
  405. if ((r = this[i] - a[i]) != 0) return r;
  406. return 0;
  407. };
  408. function bN(x) {
  409. var r = 1,
  410. t;
  411. if ((t = x >>> 16) != 0) {
  412. x = t;
  413. r += 16;
  414. }
  415. if ((t = x >> 8) != 0) {
  416. x = t;
  417. r += 8;
  418. }
  419. if ((t = x >> 4) != 0) {
  420. x = t;
  421. r += 4;
  422. }
  423. if ((t = x >> 2) != 0) {
  424. x = t;
  425. r += 2;
  426. }
  427. if ((t = x >> 1) != 0) {
  428. x = t;
  429. r += 1;
  430. }
  431. return r;
  432. };
  433. function dI() {
  434. if (this.t <= 0) return 0;
  435. return this.ct * (this.t - 1) + bN(this[this.t - 1] ^ (this.s & this.fi));
  436. };
  437. function da(n, r) {
  438. var i;
  439. for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i];
  440. for (i = n - 1; i >= 0; --i) r[i] = 0;
  441. r.t = this.t + n;
  442. r.s = this.s;
  443. };
  444. function cP(n, r) {
  445. for (var i = n; i < this.t; ++i) r[i - n] = this[i];
  446. r.t = Math.max(this.t - n, 0);
  447. r.s = this.s;
  448. };
  449. function cq(n, r) {
  450. var fD = n % this.ct;
  451. var gC = this.ct - fD;
  452. var hD = (1 << gC) - 1;
  453. var eL = Math.floor(n / this.ct),
  454. c = (this.s << fD) & this.fi,
  455. i;
  456. for (i = this.t - 1; i >= 0; --i) {
  457. r[i + eL + 1] = (this[i] >> gC) | c;
  458. c = (this[i] & hD) << fD;
  459. }
  460. for (i = eL - 1; i >= 0; --i) r[i] = 0;
  461. r[eL] = c;
  462. r.t = this.t + eL + 1;
  463. r.s = this.s;
  464. r.ff();
  465. };
  466. function dM(n, r) {
  467. r.s = this.s;
  468. var eL = Math.floor(n / this.ct);
  469. if (eL >= this.t) {
  470. r.t = 0;
  471. return;
  472. }
  473. var fD = n % this.ct;
  474. var gC = this.ct - fD;
  475. var hD = (1 << fD) - 1;
  476. r[0] = this[eL] >> fD;
  477. for (var i = eL + 1; i < this.t; ++i) {
  478. r[i - eL - 1] |= (this[i] & hD) << gC;
  479. r[i - eL] = this[i] >> fD;
  480. }
  481. if (fD > 0) r[this.t - eL - 1] |= (this.s & hD) << gC;
  482. r.t = this.t - eL;
  483. r.ff();
  484. };
  485. function de(a, r) {
  486. var i = 0,
  487. c = 0,
  488. m = Math.min(a.t, this.t);
  489. while (i < m) {
  490. c += this[i] - a[i];
  491. r[i++] = c & this.fi;
  492. c >>= this.ct;
  493. }
  494. if (a.t < this.t) {
  495. c -= a.s;
  496. while (i < this.t) {
  497. c += this[i];
  498. r[i++] = c & this.fi;
  499. c >>= this.ct;
  500. }
  501. c += this.s;
  502. } else {
  503. c += this.s;
  504. while (i < a.t) {
  505. c -= a[i];
  506. r[i++] = c & this.fi;
  507. c >>= this.ct;
  508. }
  509. c -= a.s;
  510. }
  511. r.s = (c < 0) ? -1 : 0;
  512. if (c < -1) r[i++] = this.ez + c;
  513. else if (c > 0) r[i++] = c;
  514. r.t = i;
  515. r.ff();
  516. };
  517. function bX(a, r) {
  518. var x = this.abs(),
  519. y = a.abs();
  520. var i = x.t;
  521. r.t = i + y.t;
  522. while (--i >= 0) r[i] = 0;
  523. for (i = 0; i < y.t; ++i) r[i + x.t] = x.eZ(0, y[i], r, i, 0, x.t);
  524. r.s = 0;
  525. r.ff();
  526. if (this.s != a.s) L.ZERO.cp(r, r);
  527. };
  528. function cr(r) {
  529. var x = this.abs();
  530. var i = r.t = 2 * x.t;
  531. while (--i >= 0) r[i] = 0;
  532. for (i = 0; i < x.t - 1; ++i) {
  533. var c = x.eZ(i, x[i], r, 2 * i, 0, 1);
  534. if ((r[i + x.t] += x.eZ(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.ez) {
  535. r[i + x.t] -= x.ez;
  536. r[i + x.t + 1] = 1;
  537. }
  538. }
  539. if (r.t > 0) r[r.t - 1] += x.eZ(i, x[i], r, 2 * i, 0, 1);
  540. r.s = 0;
  541. r.ff();
  542. };
  543. function dJ(m, q, r) {
  544. var hz = m.abs();
  545. if (hz.t <= 0) return;
  546. var pt = this.abs();
  547. if (pt.t < hz.t) {
  548. if (q != null) q.eT(0);
  549. if (r != null) this.eh(r);
  550. return;
  551. }
  552. if (r == null) r = C();
  553. var y = C(),
  554. jb = this.s,
  555. ms = m.s;
  556. var gP = this.ct - bN(hz[hz.t - 1]);
  557. if (gP > 0) {
  558. hz.gx(gP, y);
  559. pt.gx(gP, r);
  560. } else {
  561. hz.eh(y);
  562. pt.eh(r);
  563. }
  564. var fG = y.t;
  565. var gb = y[fG - 1];
  566. if (gb == 0) return;
  567. var jA = gb * (1 << this.iR) + ((fG > 1) ? y[fG - 2] >> this.io : 0);
  568. var kA = this.ku / jA,
  569. ko = (1 << this.iR) / jA,
  570. e = 1 << this.io;
  571. var i = r.t,
  572. j = i - fG,
  573. t = (q == null) ? C() : q;
  574. y.gS(j, t);
  575. if (r.dw(t) >= 0) {
  576. r[r.t++] = 1;
  577. r.cp(t, r);
  578. }
  579. L.ONE.gS(fG, t);
  580. t.cp(y, y);
  581. while (y.t < fG) y[y.t++] = 0;
  582. while (--j >= 0) {
  583. var gc = (r[--i] == gb) ? this.fi : Math.floor(r[i] * kA + (r[i - 1] + e) * ko);
  584. if ((r[i] += y.eZ(0, gc, r, j, 0, fG)) < gc) {
  585. y.gS(j, t);
  586. r.cp(t, r);
  587. while (r[i] < --gc) r.cp(t, r);
  588. }
  589. }
  590. if (q != null) {
  591. r.gJ(fG, q);
  592. if (jb != ms) L.ZERO.cp(q, q);
  593. }
  594. r.t = fG;
  595. r.ff();
  596. if (gP > 0) r.dY(gP, r);
  597. if (jb < 0) L.ZERO.cp(r, r);
  598. };
  599. function aZ(a) {
  600. var r = C();
  601. this.abs().fw(a, null, r);
  602. if (this.s < 0 && r.dw(L.ZERO) > 0) a.cp(r, r);
  603. return r;
  604. };
  605. function af(m) {
  606. this.m = m;
  607. };
  608. function ak(x) {
  609. if (x.s < 0 || x.dw(this.m) >= 0) return x.cl(this.m);
  610. else return x;
  611. };
  612. function aj(x) {
  613. return x;
  614. };
  615. function aU(x) {
  616. x.fw(this.m, null, x);
  617. };
  618. function bM(x, y, r) {
  619. x.gG(y, r);
  620. this.reduce(r);
  621. };
  622. function bE(x, r) {
  623. x.hc(r);
  624. this.reduce(r);
  625. };
  626. af.prototype.convert = ak;
  627. af.prototype.revert = aj;
  628. af.prototype.reduce = aU;
  629. af.prototype.fO = bM;
  630. af.prototype.eO = bE;
  631. function dh() {
  632. if (this.t < 1) return 0;
  633. var x = this[0];
  634. if ((x & 1) == 0) return 0;
  635. var y = x & 3;
  636. y = (y * (2 - (x & 0xf) * y)) & 0xf;
  637. y = (y * (2 - (x & 0xff) * y)) & 0xff;
  638. y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff;
  639. y = (y * (2 - x * y % this.ez)) % this.ez;
  640. return (y > 0) ? this.ez - y : -y;
  641. };
  642. function O(m) {
  643. this.m = m;
  644. this.ik = m.kC();
  645. this.jB = this.ik & 0x7fff;
  646. this.kl = this.ik >> 15;
  647. this.lf = (1 << (m.ct - 15)) - 1;
  648. this.kV = 2 * m.t;
  649. };
  650. function bC(x) {
  651. var r = C();
  652. x.abs().gS(this.m.t, r);
  653. r.fw(this.m, null, r);
  654. if (x.s < 0 && r.dw(L.ZERO) > 0) this.m.cp(r, r);
  655. return r;
  656. };
  657. function ax(x) {
  658. var r = C();
  659. x.eh(r);
  660. this.reduce(r);
  661. return r;
  662. };
  663. function au(x) {
  664. while (x.t <= this.kV) x[x.t++] = 0;
  665. for (var i = 0; i < this.m.t; ++i) {
  666. var j = x[i] & 0x7fff;
  667. var kh = (j * this.jB + (((j * this.kl + (x[i] >> 15) * this.jB) & this.lf) << 15)) & x.fi;
  668. j = i + this.m.t;
  669. x[j] += this.m.eZ(0, kh, x, i, 0, this.m.t);
  670. while (x[j] >= x.ez) {
  671. x[j] -= x.ez;
  672. x[++j]++;
  673. }
  674. }
  675. x.ff();
  676. x.gJ(this.m.t, x);
  677. if (x.dw(this.m) >= 0) x.cp(this.m, x);
  678. };
  679. function aC(x, r) {
  680. x.hc(r);
  681. this.reduce(r);
  682. };
  683. function bi(x, y, r) {
  684. x.gG(y, r);
  685. this.reduce(r);
  686. };
  687. O.prototype.convert = bC;
  688. O.prototype.revert = ax;
  689. O.prototype.reduce = au;
  690. O.prototype.fO = bi;
  691. O.prototype.eO = aC;
  692. function cz() {
  693. return ((this.t > 0) ? (this[0] & 1) : this.s) == 0;
  694. };
  695. function df(e, z) {
  696. if (e > 0xffffffff || e < 1) return L.ONE;
  697. var r = C(),
  698. r2 = C(),
  699. g = z.convert(this),
  700. i = bN(e) - 1;
  701. g.eh(r);
  702. while (--i >= 0) {
  703. z.eO(r, r2);
  704. if ((e & (1 << i)) > 0) z.fO(r2, g, r);
  705. else {
  706. var t = r;
  707. r = r2;
  708. r2 = t;
  709. }
  710. }
  711. return z.revert(r);
  712. };
  713. function bH(e, m) {
  714. var z;
  715. if (e < 256 || m.ef()) z = new af(m);
  716. else z = new O(m);
  717. return this.exp(e, z);
  718. };
  719. L.prototype.eh = dQ;
  720. L.prototype.eT = cS;
  721. L.prototype.hK = dc;
  722. L.prototype.ff = cf;
  723. L.prototype.gS = da;
  724. L.prototype.gJ = cP;
  725. L.prototype.gx = cq;
  726. L.prototype.dY = dM;
  727. L.prototype.cp = de;
  728. L.prototype.gG = bX;
  729. L.prototype.hc = cr;
  730. L.prototype.fw = dJ;
  731. L.prototype.kC = dh;
  732. L.prototype.ef = cz;
  733. L.prototype.exp = df;
  734. L.prototype.toString = aH;
  735. L.prototype.el = aL;
  736. L.prototype.abs = cn;
  737. L.prototype.dw = aD;
  738. L.prototype.fg = dI;
  739. L.prototype.cl = aZ;
  740. L.prototype.kr = bH;
  741. L.ZERO = H(0);
  742. L.ONE = H(1);
  743. function an() {
  744. var r = C();
  745. this.eh(r);
  746. return r;
  747. };
  748. function bK() {
  749. if (this.s < 0) {
  750. if (this.t == 1) return this[0] - this.ez;
  751. else if (this.t == 0) return -1;
  752. } else if (this.t == 1) return this[0];
  753. else if (this.t == 0) return 0;
  754. return ((this[1] & ((1 << (32 - this.ct)) - 1)) << this.ct) | this[0];
  755. };
  756. function cI() {
  757. return (this.t == 0) ? this.s : (this[0] << 24) >> 24;
  758. };
  759. function dn() {
  760. return (this.t == 0) ? this.s : (this[0] << 16) >> 16;
  761. };
  762. function ca(r) {
  763. return Math.floor(Math.LN2 * this.ct / Math.log(r));
  764. };
  765. function aF() {
  766. if (this.s < 0) return -1;
  767. else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0;
  768. else return 1;
  769. };
  770. function dk(b) {
  771. if (b == null) b = 10;
  772. if (this.eJ() == 0 || b < 2 || b > 36) return "0";
  773. var gf = this.iw(b);
  774. var a = Math.pow(b, gf);
  775. var d = H(a),
  776. y = C(),
  777. z = C(),
  778. r = "";
  779. this.fw(d, y, z);
  780. while (y.eJ() > 0) {
  781. r = (a + z.hs()).toString(b).substr(1) + r;
  782. y.fw(d, y, z);
  783. }
  784. return z.hs().toString(b) + r;
  785. };
  786. function bY(s, b) {
  787. this.eT(0);
  788. if (b == null) b = 10;
  789. var gf = this.iw(b);
  790. var d = Math.pow(b, gf),
  791. gO = false,
  792. j = 0,
  793. w = 0;
  794. for (var i = 0; i < s.length; ++i) {
  795. var x = bw(s, i);
  796. if (x < 0) {
  797. if (s.charAt(i) == "-" && this.eJ() == 0) gO = true;
  798. continue;
  799. }
  800. w = b * w + x;
  801. if (++j >= gf) {
  802. this.ja(d);
  803. this.hJ(w, 0);
  804. j = 0;
  805. w = 0;
  806. }
  807. }
  808. if (j > 0) {
  809. this.ja(Math.pow(b, j));
  810. this.hJ(w, 0);
  811. }
  812. if (gO) L.ZERO.cp(this, this);
  813. };
  814. function cX(a, b, c) {
  815. if ("number" == typeof b) {
  816. if (a < 2) this.eT(1);
  817. else {
  818. this.iM(a, c);
  819. if (!this.en(a - 1)) this.gj(L.ONE.shiftLeft(a - 1), ay, this);
  820. if (this.ef()) this.hJ(1, 0);
  821. while (!this.kv(b)) {
  822. this.hJ(2, 0);
  823. if (this.fg() > a) this.cp(L.ONE.shiftLeft(a - 1), this);
  824. }
  825. }
  826. } else {
  827. var x = new Array(),
  828. t = a & 7;
  829. x.length = (a >> 3) + 1;
  830. b.kj(x);
  831. if (t > 0) x[0] &= ((1 << t) - 1);
  832. else x[0] = 0;
  833. this.hK(x, 256);
  834. }
  835. };
  836. function bv() {
  837. var i = this.t,
  838. r = new Array();
  839. r[0] = this.s;
  840. var p = this.ct - (i * this.ct) % 8,
  841. d, k = 0;
  842. if (i-- > 0) {
  843. if (p < this.ct && (d = this[i] >> p) != (this.s & this.fi) >> p) r[k++] = d | (this.s << (this.ct - p));
  844. while (i >= 0) {
  845. if (p < 8) {
  846. d = (this[i] & ((1 << p) - 1)) << (8 - p);
  847. d |= this[--i] >> (p += this.ct - 8);
  848. } else {
  849. d = (this[i] >> (p -= 8)) & 0xff;
  850. if (p <= 0) {
  851. p += this.ct;
  852. --i;
  853. }
  854. }
  855. if ((d & 0x80) != 0) d |= -256;
  856. if (k == 0 && (this.s & 0x80) != (d & 0x80)) ++k;
  857. if (k > 0 || d != this.s) r[k++] = d;
  858. }
  859. }
  860. return r;
  861. };
  862. function ab(a) {
  863. return (this.dw(a) == 0);
  864. };
  865. function aw(a) {
  866. return (this.dw(a) < 0) ? this : a;
  867. };
  868. function ao(a) {
  869. return (this.dw(a) > 0) ? this : a;
  870. };
  871. function cC(a, hv, r) {
  872. var i, f, m = Math.min(a.t, this.t);
  873. for (i = 0; i < m; ++i) r[i] = hv(this[i], a[i]);
  874. if (a.t < this.t) {
  875. f = a.s & this.fi;
  876. for (i = m; i < this.t; ++i) r[i] = hv(this[i], f);
  877. r.t = this.t;
  878. } else {
  879. f = this.s & this.fi;
  880. for (i = m; i < a.t; ++i) r[i] = hv(f, a[i]);
  881. r.t = a.t;
  882. }
  883. r.s = hv(this.s, a.s);
  884. r.ff();
  885. };
  886. function aR(x, y) {
  887. return x & y;
  888. };
  889. function dN(a) {
  890. var r = C();
  891. this.gj(a, aR, r);
  892. return r;
  893. };
  894. function ay(x, y) {
  895. return x | y;
  896. };
  897. function bW(a) {
  898. var r = C();
  899. this.gj(a, ay, r);
  900. return r;
  901. };
  902. function aT(x, y) {
  903. return x ^ y;
  904. };
  905. function aQ(a) {
  906. var r = C();
  907. this.gj(a, aT, r);
  908. return r;
  909. };
  910. function ag(x, y) {
  911. return x & ~y;
  912. };
  913. function cg(a) {
  914. var r = C();
  915. this.gj(a, ag, r);
  916. return r;
  917. };
  918. function db() {
  919. var r = C();
  920. for (var i = 0; i < this.t; ++i) r[i] = this.fi & ~this[i];
  921. r.t = this.t;
  922. r.s = ~this.s;
  923. return r;
  924. };
  925. function cA(n) {
  926. var r = C();
  927. if (n < 0) this.dY(-n, r);
  928. else this.gx(n, r);
  929. return r;
  930. };
  931. function dv(n) {
  932. var r = C();
  933. if (n < 0) this.gx(-n, r);
  934. else this.dY(n, r);
  935. return r;
  936. };
  937. function aA(x) {
  938. if (x == 0) return -1;
  939. var r = 0;
  940. if ((x & 0xffff) == 0) {
  941. x >>= 16;
  942. r += 16;
  943. }
  944. if ((x & 0xff) == 0) {
  945. x >>= 8;
  946. r += 8;
  947. }
  948. if ((x & 0xf) == 0) {
  949. x >>= 4;
  950. r += 4;
  951. }
  952. if ((x & 3) == 0) {
  953. x >>= 2;
  954. r += 2;
  955. }
  956. if ((x & 1) == 0) ++r;
  957. return r;
  958. };
  959. function aq() {
  960. for (var i = 0; i < this.t; ++i)
  961. if (this[i] != 0) return i * this.ct + aA(this[i]);
  962. if (this.s < 0) return this.t * this.ct;
  963. return -1;
  964. };
  965. function ad(x) {
  966. var r = 0;
  967. while (x != 0) {
  968. x &= x - 1;
  969. ++r;
  970. }
  971. return r;
  972. };
  973. function cj() {
  974. var r = 0,
  975. x = this.s & this.fi;
  976. for (var i = 0; i < this.t; ++i) r += ad(this[i] ^ x);
  977. return r;
  978. };
  979. function aM(n) {
  980. var j = Math.floor(n / this.ct);
  981. if (j >= this.t) return (this.s != 0);
  982. return ((this[j] & (1 << (n % this.ct))) != 0);
  983. };
  984. function dE(n, hv) {
  985. var r = L.ONE.shiftLeft(n);
  986. this.gj(r, hv, r);
  987. return r;
  988. };
  989. function cc(n) {
  990. return this.hY(n, ay);
  991. };
  992. function cT(n) {
  993. return this.hY(n, ag);
  994. };
  995. function bb(n) {
  996. return this.hY(n, aT);
  997. };
  998. function ce(a, r) {
  999. var i = 0,
  1000. c = 0,
  1001. m = Math.min(a.t, this.t);
  1002. while (i < m) {
  1003. c += this[i] + a[i];
  1004. r[i++] = c & this.fi;
  1005. c >>= this.ct;
  1006. }
  1007. if (a.t < this.t) {
  1008. c += a.s;
  1009. while (i < this.t) {
  1010. c += this[i];
  1011. r[i++] = c & this.fi;
  1012. c >>= this.ct;
  1013. }
  1014. c += this.s;
  1015. } else {
  1016. c += this.s;
  1017. while (i < a.t) {
  1018. c += a[i];
  1019. r[i++] = c & this.fi;
  1020. c >>= this.ct;
  1021. }
  1022. c += a.s;
  1023. }
  1024. r.s = (c < 0) ? -1 : 0;
  1025. if (c > 0) r[i++] = c;
  1026. else if (c < -1) r[i++] = this.ez + c;
  1027. r.t = i;
  1028. r.ff();
  1029. };
  1030. function cO(a) {
  1031. var r = C();
  1032. this.hG(a, r);
  1033. return r;
  1034. };
  1035. function bQ(a) {
  1036. var r = C();
  1037. this.cp(a, r);
  1038. return r;
  1039. };
  1040. function bF(a) {
  1041. var r = C();
  1042. this.gG(a, r);
  1043. return r;
  1044. };
  1045. function aa() {
  1046. var r = C();
  1047. this.hc(r);
  1048. return r;
  1049. };
  1050. function bd(a) {
  1051. var r = C();
  1052. this.fw(a, r, null);
  1053. return r;
  1054. };
  1055. function cQ(a) {
  1056. var r = C();
  1057. this.fw(a, null, r);
  1058. return r;
  1059. };
  1060. function bI(a) {
  1061. var q = C(),
  1062. r = C();
  1063. this.fw(a, q, r);
  1064. return new Array(q, r);
  1065. };
  1066. function dp(n) {
  1067. this[this.t] = this.eZ(0, n - 1, this, 0, 0, this.t);
  1068. ++this.t;
  1069. this.ff();
  1070. };
  1071. function cJ(n, w) {
  1072. if (n == 0) return;
  1073. while (this.t <= w) this[this.t++] = 0;
  1074. this[w] += n;
  1075. while (this[w] >= this.ez) {
  1076. this[w] -= this.ez;
  1077. if (++w >= this.t) this[this.t++] = 0;
  1078. ++this[w];
  1079. }
  1080. };
  1081. function bj() { };
  1082. function aY(x) {
  1083. return x;
  1084. };
  1085. function aG(x, y, r) {
  1086. x.gG(y, r);
  1087. };
  1088. function bA(x, r) {
  1089. x.hc(r);
  1090. };
  1091. bj.prototype.convert = aY;
  1092. bj.prototype.revert = aY;
  1093. bj.prototype.fO = aG;
  1094. bj.prototype.eO = bA;
  1095. function cG(e) {
  1096. return this.exp(e, new bj());
  1097. };
  1098. function cW(a, n, r) {
  1099. var i = Math.min(this.t + a.t, n);
  1100. r.s = 0;
  1101. r.t = i;
  1102. while (i > 0) r[--i] = 0;
  1103. var j;
  1104. for (j = r.t - this.t; i < j; ++i) r[i + this.t] = this.eZ(0, a[i], r, i, 0, this.t);
  1105. for (j = Math.min(a.t, n); i < j; ++i) this.eZ(0, a[i], r, i, 0, n - i);
  1106. r.ff();
  1107. };
  1108. function ci(a, n, r) {
  1109. --n;
  1110. var i = r.t = this.t + a.t - n;
  1111. r.s = 0;
  1112. while (--i >= 0) r[i] = 0;
  1113. 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);
  1114. r.ff();
  1115. r.gJ(1, r);
  1116. };
  1117. function bh(m) {
  1118. this.r2 = C();
  1119. this.jx = C();
  1120. L.ONE.gS(2 * m.t, this.r2);
  1121. this.jQ = this.r2.divide(m);
  1122. this.m = m;
  1123. };
  1124. function bu(x) {
  1125. if (x.s < 0 || x.t > 2 * this.m.t) return x.cl(this.m);
  1126. else if (x.dw(this.m) < 0) return x;
  1127. else {
  1128. var r = C();
  1129. x.eh(r);
  1130. this.reduce(r);
  1131. return r;
  1132. }
  1133. };
  1134. function aN(x) {
  1135. return x;
  1136. };
  1137. function bS(x) {
  1138. x.gJ(this.m.t - 1, this.r2);
  1139. if (x.t > this.m.t + 1) {
  1140. x.t = this.m.t + 1;
  1141. x.ff();
  1142. }
  1143. this.jQ.ld(this.r2, this.m.t + 1, this.jx);
  1144. this.m.lx(this.jx, this.m.t + 1, this.r2);
  1145. while (x.dw(this.r2) < 0) x.hJ(1, this.m.t + 1);
  1146. x.cp(this.r2, x);
  1147. while (x.dw(this.m) >= 0) x.cp(this.m, x);
  1148. };
  1149. function dq(x, r) {
  1150. x.hc(r);
  1151. this.reduce(r);
  1152. };
  1153. function bU(x, y, r) {
  1154. x.gG(y, r);
  1155. this.reduce(r);
  1156. };
  1157. bh.prototype.convert = bu;
  1158. bh.prototype.revert = aN;
  1159. bh.prototype.reduce = bS;
  1160. bh.prototype.fO = bU;
  1161. bh.prototype.eO = dq;
  1162. function aE(e, m) {
  1163. var i = e.fg(),
  1164. k, r = H(1),
  1165. z;
  1166. if (i <= 0) return r;
  1167. else if (i < 18) k = 1;
  1168. else if (i < 48) k = 3;
  1169. else if (i < 144) k = 4;
  1170. else if (i < 768) k = 5;
  1171. else k = 6;
  1172. if (i < 8) z = new af(m);
  1173. else if (m.ef()) z = new bh(m);
  1174. else z = new O(m);
  1175. var g = new Array(),
  1176. n = 3,
  1177. hh = k - 1,
  1178. hx = (1 << k) - 1;
  1179. g[1] = z.convert(this);
  1180. if (k > 1) {
  1181. var jg = C();
  1182. z.eO(g[1], jg);
  1183. while (n <= hx) {
  1184. g[n] = C();
  1185. z.fO(jg, g[n - 2], g[n]);
  1186. n += 2;
  1187. }
  1188. }
  1189. var j = e.t - 1,
  1190. w, iZ = true,
  1191. r2 = C(),
  1192. t;
  1193. i = bN(e[j]) - 1;
  1194. while (j >= 0) {
  1195. if (i >= hh) w = (e[j] >> (i - hh)) & hx;
  1196. else {
  1197. w = (e[j] & ((1 << (i + 1)) - 1)) << (hh - i);
  1198. if (j > 0) w |= e[j - 1] >> (this.ct + i - hh);
  1199. }
  1200. n = k;
  1201. while ((w & 1) == 0) {
  1202. w >>= 1;
  1203. --n;
  1204. }
  1205. if ((i -= n) < 0) {
  1206. i += this.ct;
  1207. --j;
  1208. }
  1209. if (iZ) {
  1210. g[w].eh(r);
  1211. iZ = false;
  1212. } else {
  1213. while (n > 1) {
  1214. z.eO(r, r2);
  1215. z.eO(r2, r);
  1216. n -= 2;
  1217. }
  1218. if (n > 0) z.eO(r, r2);
  1219. else {
  1220. t = r;
  1221. r = r2;
  1222. r2 = t;
  1223. }
  1224. z.fO(r2, g[w], r);
  1225. }
  1226. while (j >= 0 && (e[j] & (1 << i)) == 0) {
  1227. z.eO(r, r2);
  1228. t = r;
  1229. r = r2;
  1230. r2 = t;
  1231. if (--i < 0) {
  1232. i = this.ct - 1;
  1233. --j;
  1234. }
  1235. }
  1236. }
  1237. return z.revert(r);
  1238. };
  1239. function aV(a) {
  1240. var x = (this.s < 0) ? this.el() : this.clone();
  1241. var y = (a.s < 0) ? a.el() : a.clone();
  1242. if (x.dw(y) < 0) {
  1243. var t = x;
  1244. x = y;
  1245. y = t;
  1246. }
  1247. var i = x.gg(),
  1248. g = y.gg();
  1249. if (g < 0) return x;
  1250. if (i < g) g = i;
  1251. if (g > 0) {
  1252. x.dY(g, x);
  1253. y.dY(g, y);
  1254. }
  1255. while (x.eJ() > 0) {
  1256. if ((i = x.gg()) > 0) x.dY(i, x);
  1257. if ((i = y.gg()) > 0) y.dY(i, y);
  1258. if (x.dw(y) >= 0) {
  1259. x.cp(y, x);
  1260. x.dY(1, x);
  1261. } else {
  1262. y.cp(x, y);
  1263. y.dY(1, y);
  1264. }
  1265. }
  1266. if (g > 0) y.gx(g, y);
  1267. return y;
  1268. };
  1269. function di(n) {
  1270. if (n <= 0) return 0;
  1271. var d = this.ez % n,
  1272. r = (this.s < 0) ? n - 1 : 0;
  1273. if (this.t > 0)
  1274. if (d == 0) r = this[0] % n;
  1275. else
  1276. for (var i = this.t - 1; i >= 0; --i) r = (d * r + this[i]) % n;
  1277. return r;
  1278. };
  1279. function ah(m) {
  1280. var fY = m.ef();
  1281. if ((this.ef() && fY) || m.eJ() == 0) return L.ZERO;
  1282. var u = m.clone(),
  1283. v = this.clone();
  1284. var a = H(1),
  1285. b = H(0),
  1286. c = H(0),
  1287. d = H(1);
  1288. while (u.eJ() != 0) {
  1289. while (u.ef()) {
  1290. u.dY(1, u);
  1291. if (fY) {
  1292. if (!a.ef() || !b.ef()) {
  1293. a.hG(this, a);
  1294. b.cp(m, b);
  1295. }
  1296. a.dY(1, a);
  1297. } else if (!b.ef()) b.cp(m, b);
  1298. b.dY(1, b);
  1299. }
  1300. while (v.ef()) {
  1301. v.dY(1, v);
  1302. if (fY) {
  1303. if (!c.ef() || !d.ef()) {
  1304. c.hG(this, c);
  1305. d.cp(m, d);
  1306. }
  1307. c.dY(1, c);
  1308. } else if (!d.ef()) d.cp(m, d);
  1309. d.dY(1, d);
  1310. }
  1311. if (u.dw(v) >= 0) {
  1312. u.cp(v, u);
  1313. if (fY) a.cp(c, a);
  1314. b.cp(d, b);
  1315. } else {
  1316. v.cp(u, v);
  1317. if (fY) c.cp(a, c);
  1318. d.cp(b, d);
  1319. }
  1320. }
  1321. if (v.dw(L.ONE) != 0) return L.ZERO;
  1322. if (d.dw(m) >= 0) return d.cv(m);
  1323. if (d.eJ() < 0) d.hG(m, d);
  1324. else return d;
  1325. if (d.eJ() < 0) return d.add(m);
  1326. else return d;
  1327. };
  1328. 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,
  1329. 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233,
  1330. 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373,
  1331. 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509,
  1332. 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659,
  1333. 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823,
  1334. 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983,
  1335. 991, 997
  1336. ];
  1337. var kE = (1 << 26) / eb[eb.length - 1];
  1338. function as(t) {
  1339. var i, x = this.abs();
  1340. if (x.t == 1 && x[0] <= eb[eb.length - 1]) {
  1341. for (i = 0; i < eb.length; ++i)
  1342. if (x[0] == eb[i]) return true;
  1343. return false;
  1344. }
  1345. if (x.ef()) return false;
  1346. i = 1;
  1347. while (i < eb.length) {
  1348. var m = eb[i],
  1349. j = i + 1;
  1350. while (j < eb.length && m < kE) m *= eb[j++];
  1351. m = x.kq(m);
  1352. while (i < j)
  1353. if (m % eb[i++] == 0) return false;
  1354. }
  1355. return x.kJ(t);
  1356. };
  1357. function dR(t) {
  1358. var gV = this.cv(L.ONE);
  1359. var k = gV.gg();
  1360. if (k <= 0) return false;
  1361. var r = gV.ic(k);
  1362. t = (t + 1) >> 1;
  1363. if (t > eb.length) t = eb.length;
  1364. var a = C();
  1365. for (var i = 0; i < t; ++i) {
  1366. a.eT(eb[Math.floor(Math.random() * eb.length)]);
  1367. var y = a.lb(r, this);
  1368. if (y.dw(L.ONE) != 0 && y.dw(gV) != 0) {
  1369. var j = 1;
  1370. while (j++ < k && y.dw(gV) != 0) {
  1371. y = y.kr(2, this);
  1372. if (y.dw(L.ONE) == 0) return false;
  1373. }
  1374. if (y.dw(gV) != 0) return false;
  1375. }
  1376. }
  1377. return true;
  1378. };
  1379. L.prototype.iw = ca;
  1380. L.prototype.eD = dk;
  1381. L.prototype.jP = bY;
  1382. L.prototype.iM = cX;
  1383. L.prototype.gj = cC;
  1384. L.prototype.hY = dE;
  1385. L.prototype.hG = ce;
  1386. L.prototype.ja = dp;
  1387. L.prototype.hJ = cJ;
  1388. L.prototype.lx = cW;
  1389. L.prototype.ld = ci;
  1390. L.prototype.kq = di;
  1391. L.prototype.kJ = dR;
  1392. L.prototype.clone = an;
  1393. L.prototype.hs = bK;
  1394. L.prototype.lQ = cI;
  1395. L.prototype.lZ = dn;
  1396. L.prototype.eJ = aF;
  1397. L.prototype.gv = bv;
  1398. L.prototype.equals = ab;
  1399. L.prototype.min = aw;
  1400. L.prototype.max = ao;
  1401. L.prototype.and = dN;
  1402. L.prototype.jw = bW;
  1403. L.prototype.xor = aQ;
  1404. L.prototype.mg = cg;
  1405. L.prototype.not = db;
  1406. L.prototype.shiftLeft = cA;
  1407. L.prototype.ic = dv;
  1408. L.prototype.gg = aq;
  1409. L.prototype.nx = cj;
  1410. L.prototype.en = aM;
  1411. L.prototype.nu = cc;
  1412. L.prototype.mR = cT;
  1413. L.prototype.nc = bb;
  1414. L.prototype.add = cO;
  1415. L.prototype.cv = bQ;
  1416. L.prototype.multiply = bF;
  1417. L.prototype.divide = bd;
  1418. L.prototype.mU = cQ;
  1419. L.prototype.lH = bI;
  1420. L.prototype.lb = aE;
  1421. L.prototype.fZ = ah;
  1422. L.prototype.pow = cG;
  1423. L.prototype.mN = aV;
  1424. L.prototype.kv = as;
  1425. L.prototype.square = aa;
  1426. function J(q, x) {
  1427. this.x = x;
  1428. this.q = q;
  1429. };
  1430. function bx(other) {
  1431. if (other == this) return true;
  1432. return (this.q.equals(other.q) && this.x.equals(other.x));
  1433. };
  1434. function av() {
  1435. return this.x;
  1436. };
  1437. function aO() {
  1438. return new J(this.q, this.x.el().cl(this.q));
  1439. };
  1440. function bz(b) {
  1441. return new J(this.q, this.x.add(b.cR()).cl(this.q));
  1442. };
  1443. function be(b) {
  1444. return new J(this.q, this.x.cv(b.cR()).cl(this.q));
  1445. };
  1446. function bf(b) {
  1447. return new J(this.q, this.x.multiply(b.cR()).cl(this.q));
  1448. };
  1449. function aJ() {
  1450. return new J(this.q, this.x.square().cl(this.q));
  1451. };
  1452. function ar(b) {
  1453. return new J(this.q, this.x.multiply(b.cR().fZ(this.q)).cl(this.q));
  1454. };
  1455. J.prototype.equals = bx;
  1456. J.prototype.cR = av;
  1457. J.prototype.el = aO;
  1458. J.prototype.add = bz;
  1459. J.prototype.cv = be;
  1460. J.prototype.multiply = bf;
  1461. J.prototype.square = aJ;
  1462. J.prototype.divide = ar;
  1463. function G(dP, x, y, z) {
  1464. this.dP = dP;
  1465. this.x = x;
  1466. this.y = y;
  1467. if (z == null) {
  1468. this.z = L.ONE;
  1469. } else {
  1470. this.z = z;
  1471. }
  1472. this.gH = null;
  1473. };
  1474. function az() {
  1475. if (this.gH == null) {
  1476. this.gH = this.z.fZ(this.dP.q);
  1477. }
  1478. return this.dP.fm(this.x.cR().multiply(this.gH).cl(this.dP.q));
  1479. };
  1480. function bP() {
  1481. if (this.gH == null) {
  1482. this.gH = this.z.fZ(this.dP.q);
  1483. }
  1484. return this.dP.fm(this.y.cR().multiply(this.gH).cl(this.dP.q));
  1485. };
  1486. function bV(other) {
  1487. if (other == this) return true;
  1488. if (this.eg()) return other.eg();
  1489. if (other.eg()) return this.eg();
  1490. var u, v;
  1491. u = other.y.cR().multiply(this.z).cv(this.y.cR().multiply(other.z)).cl(this.dP.q);
  1492. if (!u.equals(L.ZERO)) return false;
  1493. v = other.x.cR().multiply(this.z).cv(this.x.cR().multiply(other.z)).cl(this.dP.q);
  1494. return v.equals(L.ZERO);
  1495. };
  1496. function bp() {
  1497. if ((this.x == null) && (this.y == null)) return true;
  1498. return this.z.equals(L.ZERO) && !this.y.cR().equals(L.ZERO);
  1499. };
  1500. function aX() {
  1501. return new G(this.dP, this.x, this.y.el(), this.z);
  1502. };
  1503. function aB(b) {
  1504. if (this.eg()) return b;
  1505. if (b.eg()) return this;
  1506. var u = b.y.cR().multiply(this.z).cv(this.y.cR().multiply(b.z)).cl(this.dP.q);
  1507. var v = b.x.cR().multiply(this.z).cv(this.x.cR().multiply(b.z)).cl(this.dP.q);
  1508. if (L.ZERO.equals(v)) {
  1509. if (L.ZERO.equals(u)) {
  1510. return this.gI();
  1511. }
  1512. return this.dP.gy();
  1513. }
  1514. var hm = new L("3");
  1515. var x1 = this.x.cR();
  1516. var y1 = this.y.cR();
  1517. var iT = v.square();
  1518. var hq = iT.multiply(v);
  1519. var iy = x1.multiply(iT);
  1520. var iq = u.square().multiply(this.z);
  1521. var eE = iq.cv(iy.shiftLeft(1)).multiply(b.z).cv(hq).multiply(v).cl(this.dP.q);
  1522. var fE = iy.multiply(hm).multiply(u).cv(y1.multiply(hq)).cv(iq.multiply(u)).multiply(b.z).add(u.multiply(hq)).cl(this
  1523. .dP.q);
  1524. var js = hq.multiply(this.z).multiply(b.z).cl(this.dP.q);
  1525. return new G(this.dP, this.dP.fm(eE), this.dP.fm(fE), js);
  1526. };
  1527. function bq() {
  1528. if (this.eg()) return this;
  1529. if (this.y.cR().eJ() == 0) return this.dP.gy();
  1530. var hm = new L("3");
  1531. var x1 = this.x.cR();
  1532. var y1 = this.y.cR();
  1533. var gz = y1.multiply(this.z);
  1534. var jp = gz.multiply(y1).cl(this.dP.q);
  1535. var a = this.dP.a.cR();
  1536. var w = x1.square().multiply(hm);
  1537. if (!L.ZERO.equals(a)) {
  1538. w = w.add(this.z.square().multiply(a));
  1539. }
  1540. w = w.cl(this.dP.q);
  1541. var eE = w.square().cv(x1.shiftLeft(3).multiply(jp)).shiftLeft(1).multiply(gz).cl(this.dP.q);
  1542. var fE = w.multiply(hm).multiply(x1).cv(jp.shiftLeft(1)).shiftLeft(2).multiply(jp).cv(w.square().multiply(w)).cl(this
  1543. .dP.q);
  1544. var js = gz.square().multiply(gz).shiftLeft(3).cl(this.dP.q);
  1545. return new G(this.dP, this.dP.fm(eE), this.dP.fm(fE), js);
  1546. };
  1547. function ai(k) {
  1548. if (this.eg()) return this;
  1549. if (k.eJ() == 0) return this.dP.gy();
  1550. var e = k;
  1551. var h = e.multiply(new L("3"));
  1552. var hw = this.el();
  1553. var R = this;
  1554. var i;
  1555. for (i = h.fg() - 2; i > 0; --i) {
  1556. R = R.gI();
  1557. var gm = h.en(i);
  1558. var hV = e.en(i);
  1559. if (gm != hV) {
  1560. R = R.add(gm ? this : hw);
  1561. }
  1562. }
  1563. return R;
  1564. };
  1565. function aS(j, x, k) {
  1566. var i;
  1567. if (j.fg() > k.fg()) i = j.fg() - 1;
  1568. else i = k.fg() - 1;
  1569. var R = this.dP.gy();
  1570. var both = this.add(x);
  1571. while (i >= 0) {
  1572. R = R.gI();
  1573. if (j.en(i)) {
  1574. if (k.en(i)) {
  1575. R = R.add(both);
  1576. } else {
  1577. R = R.add(this);
  1578. }
  1579. } else {
  1580. if (k.en(i)) {
  1581. R = R.add(x);
  1582. }
  1583. } --i;
  1584. }
  1585. return R;
  1586. };
  1587. G.prototype.fI = az;
  1588. G.prototype.ec = bP;
  1589. G.prototype.equals = bV;
  1590. G.prototype.eg = bp;
  1591. G.prototype.el = aX;
  1592. G.prototype.add = aB;
  1593. G.prototype.gI = bq;
  1594. G.prototype.multiply = ai;
  1595. G.prototype.nb = aS;
  1596. function V(q, a, b) {
  1597. this.q = q;
  1598. this.a = this.fm(a);
  1599. this.b = this.fm(b);
  1600. this.jz = new G(this, null, null);
  1601. };
  1602. function bO() {
  1603. return this.q;
  1604. };
  1605. function aW() {
  1606. return this.a;
  1607. };
  1608. function bc() {
  1609. return this.b;
  1610. };
  1611. function bJ(other) {
  1612. if (other == this) return true;
  1613. return (this.q.equals(other.q) && this.a.equals(other.a) && this.b.equals(other.b));
  1614. };
  1615. function bn() {
  1616. return this.jz;
  1617. };
  1618. function ae(x) {
  1619. return new J(this.q, x);
  1620. };
  1621. function by(s) {
  1622. switch (parseInt(s.substr(0, 2), 16)) {
  1623. case 0:
  1624. return this.jz;
  1625. case 2:
  1626. case 3:
  1627. return null;
  1628. case 4:
  1629. case 6:
  1630. case 7:
  1631. var dm = (s.length - 2) / 2;
  1632. var hf = s.substr(2, dm);
  1633. var ih = s.substr(dm + 2, dm);
  1634. return new G(this, this.fm(new L(hf, 16)), this.fm(new L(ih, 16)));
  1635. default:
  1636. return null;
  1637. }
  1638. };
  1639. function bG(x, y) {
  1640. return new G(this, this.fm(x), this.fm(y));
  1641. };
  1642. V.prototype.jh = bO;
  1643. V.prototype.kH = aW;
  1644. V.prototype.kB = bc;
  1645. V.prototype.equals = bJ;
  1646. V.prototype.gy = bn;
  1647. V.prototype.fm = ae;
  1648. V.prototype.kR = by;
  1649. V.prototype.kU = bG;
  1650. J.prototype.lO = function () {
  1651. return Math.floor((this.cR().fg() + 7) / 8);
  1652. };
  1653. G.prototype.mj = function (jG) {
  1654. var hM = function (i, dm) {
  1655. var ev = i.lW();
  1656. if (dm < ev.length) {
  1657. ev = ev.slice(ev.length - dm);
  1658. } else
  1659. while (dm > ev.length) {
  1660. ev.unshift(0);
  1661. }
  1662. return ev;
  1663. };
  1664. var x = this.fI().cR();
  1665. var y = this.ec().cR();
  1666. var ey = hM(x, 32);
  1667. if (jG) {
  1668. if (y.ef()) {
  1669. ey.unshift(0x02);
  1670. } else {
  1671. ey.unshift(0x03);
  1672. }
  1673. } else {
  1674. ey.unshift(0x04);
  1675. ey = ey.concat(hM(y, 32));
  1676. }
  1677. return ey;
  1678. };
  1679. G.jZ = function (dP, ey) {
  1680. var ea = ey.length - 1;
  1681. var iP = ey.slice(1, 1 + ea / 2);
  1682. var je = ey.slice(1 + ea / 2, 1 + ea);
  1683. iP.unshift(0);
  1684. je.unshift(0);
  1685. var x = new L(iP);
  1686. var y = new L(je);
  1687. return new G(dP, dP.fm(x), dP.fm(y));
  1688. };
  1689. G.hQ = function (dP, hU) {
  1690. var ea = hU.length - 2;
  1691. var hf = hU.substr(2, ea / 2);
  1692. var ih = hU.substr(2 + ea / 2, ea / 2);
  1693. var x = new L(hf, 16);
  1694. var y = new L(ih, 16);
  1695. return new G(dP, dP.fm(x), dP.fm(y));
  1696. };
  1697. G.prototype.jK = function (b) {
  1698. if (this.eg()) return b;
  1699. if (b.eg()) return this;
  1700. if (this.x.equals(b.x)) {
  1701. if (this.y.equals(b.y)) {
  1702. return this.gI();
  1703. }
  1704. return this.dP.gy();
  1705. }
  1706. var kW = b.x.cv(this.x);
  1707. var la = b.y.cv(this.y);
  1708. var hl = la.divide(kW);
  1709. var eE = hl.square().cv(this.x).cv(b.x);
  1710. var fE = hl.multiply(this.x.cv(eE)).cv(this.y);
  1711. return new G(this.dP, eE, fE);
  1712. };
  1713. G.prototype.mV = function () {
  1714. if (this.eg()) return this;
  1715. if (this.y.cR().eJ() == 0) {
  1716. return this.dP.gy();
  1717. }
  1718. var jF = this.dP.fm(L.valueOf(2));
  1719. var hm = this.dP.fm(L.valueOf(3));
  1720. var hl = this.x.square().multiply(hm).add(this.dP.a).divide(this.y.multiply(jF));
  1721. var eE = hl.square().cv(this.x.multiply(jF));
  1722. var fE = hl.multiply(this.x.cv(eE)).cv(this.y);
  1723. return new G(this.dP, eE, fE);
  1724. };
  1725. G.prototype.nl = function (k) {
  1726. if (this.eg()) return this;
  1727. if (k.eJ() == 0) return this.dP.gy();
  1728. var e = k;
  1729. var h = e.multiply(new L("3"));
  1730. var hw = this.el();
  1731. var R = this;
  1732. var i;
  1733. for (i = h.fg() - 2; i > 0; --i) {
  1734. R = R.gI();
  1735. var gm = h.en(i);
  1736. var hV = e.en(i);
  1737. if (gm != hV) {
  1738. R = R.jK(gm ? this : hw);
  1739. }
  1740. }
  1741. return R;
  1742. };
  1743. G.prototype.kM = function () {
  1744. var x = this.fI().cR();
  1745. var y = this.ec().cR();
  1746. var a = this.dP.kH().cR();
  1747. var b = this.dP.kB().cR();
  1748. var n = this.dP.jh();
  1749. var lhs = y.multiply(y).cl(n);
  1750. var rhs = x.multiply(x).multiply(x).add(a.multiply(x)).add(b).cl(n);
  1751. return lhs.equals(rhs);
  1752. };
  1753. G.prototype.toString = function () {
  1754. return '(' + this.fI().cR().toString() + ',' + this.ec().cR().toString() + ')';
  1755. };
  1756. G.prototype.mY = function () {
  1757. var n = this.dP.jh();
  1758. if (this.eg()) {
  1759. throw new Error("Point is at jz.");
  1760. }
  1761. var x = this.fI().cR();
  1762. var y = this.ec().cR();
  1763. if (x.dw(L.ONE) < 0 || x.dw(n.cv(L.ONE)) > 0) {
  1764. throw new Error('x coordinate out of bounds');
  1765. }
  1766. if (y.dw(L.ONE) < 0 || y.dw(n.cv(L.ONE)) > 0) {
  1767. throw new Error('y coordinate out of bounds');
  1768. }
  1769. if (!this.kM()) {
  1770. throw new Error("Point is not on the dP.");
  1771. }
  1772. if (this.multiply(n).eg()) {
  1773. throw new Error("Point is not a scalar multiple of G.");
  1774. }
  1775. return true;
  1776. };
  1777. function bo() {
  1778. this.fB = null;
  1779. this.et = null;
  1780. this.iA = null;
  1781. this.hb = 256;
  1782. this.ho = 0;
  1783. this.gR = 0;
  1784. this.eu = new Array();
  1785. if (this.fB == null) {
  1786. this.fB = new Array();
  1787. this.et = 0;
  1788. if (navigator.appName == "Netscape" && navigator.appVersion < "5" && window.crypto) {
  1789. var z = window.crypto.random(32);
  1790. for (var t = 0; t < z.length; ++t) {
  1791. this.fB[this.et++] = z.charCodeAt(t) & 255;
  1792. }
  1793. }
  1794. while (this.et < this.hb) {
  1795. t = Math.floor(65536 * Math.random());
  1796. this.fB[this.et++] = t >>> 8;
  1797. this.fB[this.et++] = t & 255;
  1798. }
  1799. this.et = 0;
  1800. this.jj();
  1801. }
  1802. };
  1803. bo.prototype = {
  1804. ka: function (x) {
  1805. this.fB[this.et++] ^= x & 255;
  1806. this.fB[this.et++] ^= (x >> 8) & 255;
  1807. this.fB[this.et++] ^= (x >> 16) & 255;
  1808. this.fB[this.et++] ^= (x >> 24) & 255;
  1809. if (this.et >= this.hb) this.et -= this.hb;
  1810. },
  1811. jj: function () {
  1812. this.ka(new Date().getTime());
  1813. },
  1814. kg: function () {
  1815. if (this.iA == null) {
  1816. this.jj();
  1817. this.iA = 1;
  1818. this.gD(this.fB);
  1819. for (var et = 0; et < this.fB.length; ++et) {
  1820. this.fB[et] = 0;
  1821. }
  1822. this.et = 0;
  1823. }
  1824. return this.next();
  1825. },
  1826. kj: function (iQ) {
  1827. var i;
  1828. for (i = 0; i < iQ.length; ++i) iQ[i] = this.kg();
  1829. },
  1830. gD: function (key) {
  1831. var i, j, t;
  1832. for (i = 0; i < 256; ++i) this.eu[i] = i;
  1833. j = 0;
  1834. for (i = 0; i < 256; ++i) {
  1835. j = (j + this.eu[i] + key[i % key.length]) & 255;
  1836. t = this.eu[i];
  1837. this.eu[i] = this.eu[j];
  1838. this.eu[j] = t;
  1839. }
  1840. this.ho = 0;
  1841. this.gR = 0;
  1842. },
  1843. next: function () {
  1844. var t;
  1845. this.ho = (this.ho + 1) & 255;
  1846. this.gR = (this.gR + this.eu[this.ho]) & 255;
  1847. t = this.eu[this.ho];
  1848. this.eu[this.ho] = this.eu[this.gR];
  1849. this.eu[this.gR] = t;
  1850. return this.eu[(t + this.eu[this.ho]) & 255];
  1851. }
  1852. };
  1853. function aP() {
  1854. this.dX = new Array(0xd6, 0x90, 0xe9, 0xfe, 0xcc, 0xe1, 0x3d, 0xb7, 0x16, 0xb6, 0x14, 0xc2, 0x28, 0xfb, 0x2c, 0x05,
  1855. 0x2b, 0x67, 0x9a, 0x76, 0x2a, 0xbe, 0x04, 0xc3, 0xaa, 0x44, 0x13, 0x26, 0x49, 0x86, 0x06, 0x99, 0x9c, 0x42, 0x50,
  1856. 0xf4, 0x91, 0xef, 0x98, 0x7a, 0x33, 0x54, 0x0b, 0x43, 0xed, 0xcf, 0xac, 0x62, 0xe4, 0xb3, 0x1c, 0xa9, 0xc9, 0x08,
  1857. 0xe8, 0x95, 0x80, 0xdf, 0x94, 0xfa, 0x75, 0x8f, 0x3f, 0xa6, 0x47, 0x07, 0xa7, 0xfc, 0xf3, 0x73, 0x17, 0xba, 0x83,
  1858. 0x59, 0x3c, 0x19, 0xe6, 0x85, 0x4f, 0xa8, 0x68, 0x6b, 0x81, 0xb2, 0x71, 0x64, 0xda, 0x8b, 0xf8, 0xeb, 0x0f, 0x4b,
  1859. 0x70, 0x56, 0x9d, 0x35, 0x1e, 0x24, 0x0e, 0x5e, 0x63, 0x58, 0xd1, 0xa2, 0x25, 0x22, 0x7c, 0x3b, 0x01, 0x21, 0x78,
  1860. 0x87, 0xd4, 0x00, 0x46, 0x57, 0x9f, 0xd3, 0x27, 0x52, 0x4c, 0x36, 0x02, 0xe7, 0xa0, 0xc4, 0xc8, 0x9e, 0xea, 0xbf,
  1861. 0x8a, 0xd2, 0x40, 0xc7, 0x38, 0xb5, 0xa3, 0xf7, 0xf2, 0xce, 0xf9, 0x61, 0x15, 0xa1, 0xe0, 0xae, 0x5d, 0xa4, 0x9b,
  1862. 0x34, 0x1a, 0x55, 0xad, 0x93, 0x32, 0x30, 0xf5, 0x8c, 0xb1, 0xe3, 0x1d, 0xf6, 0xe2, 0x2e, 0x82, 0x66, 0xca, 0x60,
  1863. 0xc0, 0x29, 0x23, 0xab, 0x0d, 0x53, 0x4e, 0x6f, 0xd5, 0xdb, 0x37, 0x45, 0xde, 0xfd, 0x8e, 0x2f, 0x03, 0xff, 0x6a,
  1864. 0x72, 0x6d, 0x6c, 0x5b, 0x51, 0x8d, 0x1b, 0xaf, 0x92, 0xbb, 0xdd, 0xbc, 0x7f, 0x11, 0xd9, 0x5c, 0x41, 0x1f, 0x10,
  1865. 0x5a, 0xd8, 0x0a, 0xc1, 0x31, 0x88, 0xa5, 0xcd, 0x7b, 0xbd, 0x2d, 0x74, 0xd0, 0x12, 0xb8, 0xe5, 0xb4, 0xb0, 0x89,
  1866. 0x69, 0x97, 0x4a, 0x0c, 0x96, 0x77, 0x7e, 0x65, 0xb9, 0xf1, 0x09, 0xc5, 0x6e, 0xc6, 0x84, 0x18, 0xf0, 0x7d, 0xec,
  1867. 0x3a, 0xdc, 0x4d, 0x20, 0x79, 0xee, 0x5f, 0x3e, 0xd7, 0xcb, 0x39, 0x48);
  1868. this.gi = new Array(0xa3b1bac6, 0x56aa3350, 0x677d9197, 0xb27022dc);
  1869. this.kw = new Array(0x00070e15, 0x1c232a31, 0x383f464d, 0x545b6269, 0x70777e85, 0x8c939aa1, 0xa8afb6bd, 0xc4cbd2d9,
  1870. 0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249, 0x50575e65, 0x6c737a81, 0x888f969d, 0xa4abb2b9, 0xc0c7ced5,
  1871. 0xdce3eaf1, 0xf8ff060d, 0x141b2229, 0x30373e45, 0x4c535a61, 0x686f767d, 0x848b9299, 0xa0a7aeb5, 0xbcc3cad1,
  1872. 0xd8dfe6ed, 0xf4fb0209, 0x10171e25, 0x2c333a41, 0x484f565d, 0x646b7279);
  1873. };
  1874. aP.prototype = {
  1875. hy: function (key) {
  1876. var k = new Array(36);
  1877. var gM = aI(key);
  1878. k[0] = gM[0] ^ this.gi[0];
  1879. k[1] = gM[1] ^ this.gi[1];
  1880. k[2] = gM[2] ^ this.gi[2];
  1881. k[3] = gM[3] ^ this.gi[3];
  1882. var fH = new Array(32);
  1883. for (var i = 0; i < 32; i++) {
  1884. k[(i + 4)] = (k[i] ^ this.jO(k[(i + 1)] ^ k[(i + 2)] ^ k[(i + 3)] ^ this.kw[i]));
  1885. fH[i] = k[(i + 4)];
  1886. }
  1887. return fH;
  1888. },
  1889. jO: function (fS) {
  1890. var b = new Array(4);
  1891. var a = F(fS);
  1892. b[0] = this.dX[a[0] & 0xFF];
  1893. b[1] = this.dX[a[1] & 0xFF];
  1894. b[2] = this.dX[a[2] & 0xFF];
  1895. b[3] = this.dX[a[3] & 0xFF];
  1896. var ek = bB(b, 0);
  1897. var fH = ek ^ (ek << 13 | (ek >>> (32 - 13))) ^ (ek << 23 | (ek >>> (32 - 23)));
  1898. return fH;
  1899. },
  1900. eA: function (fH, data) {
  1901. var x = new Array(36);
  1902. x[0] = bB(data, 0);
  1903. x[1] = bB(data, 4);
  1904. x[2] = bB(data, 8);
  1905. x[3] = bB(data, 12);
  1906. for (var i = 0; i < 32; i++) {
  1907. x[(i + 4)] = x[i] ^ this.kN(x[(i + 1)] ^ x[(i + 2)] ^ x[(i + 3)] ^ fH[i]);
  1908. }
  1909. var iI = new Array(4);
  1910. for (var i = 35; i >= 32; i--) {
  1911. iI[35 - i] = x[i];
  1912. }
  1913. var kS = ap(iI);
  1914. return kS;
  1915. },
  1916. kN: function (fS) {
  1917. var a = F(fS);
  1918. var b = new Array(4);
  1919. b[0] = this.dX[a[0] & 0xFF];
  1920. b[1] = this.dX[a[1] & 0xFF];
  1921. b[2] = this.dX[a[2] & 0xFF];
  1922. b[3] = this.dX[a[3] & 0xFF];
  1923. var ek = bB(b, 0);
  1924. var c = ek ^ (ek << 2 | (ek >>> (32 - 2))) ^ (ek << 10 | (ek >>> (32 - 10))) ^ (ek << 18 | (ek >>> (32 - 18))) ^
  1925. (ek << 24 | (ek >>> (32 - 24)));
  1926. return c;
  1927. },
  1928. gY: function (input, mode) {
  1929. if (input == null) {
  1930. return null;
  1931. }
  1932. var gT = null;
  1933. if (mode == 1) {
  1934. var p = 16 - input.length % 16;
  1935. gT = new Array(input.length + p);
  1936. K(input, 0, gT, 0, input.length);
  1937. for (var i = 0; i < p; i++) {
  1938. gT[input.length + i] = p;
  1939. }
  1940. } else {
  1941. var p = input[input.length - 1];
  1942. gT = new Array(input.length - p);
  1943. K(input, 0, gT, 0, input.length - p);
  1944. }
  1945. return gT;
  1946. },
  1947. lk: function (data, key) {
  1948. if (data == undefined || data == null || data.length <= 0) {
  1949. dB.log("data is error!");
  1950. return null;
  1951. }
  1952. if (key == undefined || key == null || key.length % 16 != 0) {
  1953. dB.log("dV key is error!");
  1954. return null;
  1955. }
  1956. var fH = this.hy(key);
  1957. var cU = 16;
  1958. var loop = parseInt(data.length / cU);
  1959. var cw = new Array((loop + 1) * cU);
  1960. var dF = new Array(cU);
  1961. var hk = null;
  1962. for (var i = 0; i < loop; i++) {
  1963. K(data, i * cU, dF, 0, cU);
  1964. hk = this.eA(fH, dF);
  1965. K(hk, 0, cw, i * cU, cU);
  1966. }
  1967. var eR = new Array(data.length % cU);
  1968. if (eR.length > 0) {
  1969. K(data, loop * cU, eR, 0, data.length % cU);
  1970. }
  1971. var padding = this.gY(eR, 1);
  1972. hk = this.eA(fH, padding);
  1973. K(hk, 0, cw, loop * cU, cU);
  1974. return cw;
  1975. },
  1976. kY: function (data, key) {
  1977. if (data == undefined || data == null || data.length % 16 != 0) {
  1978. dB.log("data is error!");
  1979. return null;
  1980. }
  1981. if (key == undefined || key == null || key.length % 16 != 0) {
  1982. dB.log("dV key is error!");
  1983. return null;
  1984. }
  1985. var fH = this.hy(key);
  1986. var gW = new Array(32);
  1987. for (var i = 0; i < fH.length; i++) {
  1988. gW[i] = fH[32 - i - 1];
  1989. }
  1990. var cU = 16;
  1991. var loop = data.length / cU - 1;
  1992. var dF = new Array(cU);
  1993. var fh = null;
  1994. var fz = null;
  1995. K(data, loop * cU, dF, 0, cU);
  1996. fh = this.eA(gW, dF);
  1997. var eY = this.gY(fh, 0);
  1998. fz = new Array(loop * cU + eY.length);
  1999. K(eY, 0, fz, loop * cU, eY.length);
  2000. for (var i = 0; i < loop; i++) {
  2001. K(data, i * cU, dF, 0, cU);
  2002. fh = this.eA(gW, dF);
  2003. K(fh, 0, fz, i * cU, cU);
  2004. }
  2005. return fz;
  2006. },
  2007. ll: function (data, key, cd) {
  2008. if (cd == undefined || cd == null || cd.length % 16 != 0) {
  2009. dB.log("cd is error!");
  2010. return null;
  2011. }
  2012. if (key == undefined || key == null || key.length % 16 != 0) {
  2013. dB.log("dV key is error!");
  2014. return null;
  2015. }
  2016. if (data == undefined || data == null || data.length <= 0) {
  2017. dB.log("data is error!");
  2018. return null;
  2019. }
  2020. var fH = this.hy(key);
  2021. var cU = 16;
  2022. var loop = parseInt(data.length / cU);
  2023. var cw = new Array((loop + 1) * cU);
  2024. var dF = new Array(cU);
  2025. for (var i = 0; i < loop; i++) {
  2026. K(data, i * cU, dF, 0, cU);
  2027. for (var j = 0; j < cU; j++) {
  2028. dF[j] = dF[j] ^ cd[j];
  2029. }
  2030. cd = this.eA(fH, dF);
  2031. K(cd, 0, cw, i * cU, cU);
  2032. }
  2033. var eR = new Array(data.length % cU);
  2034. if (eR.length > 0) {
  2035. K(data, loop * cU, eR, 0, data.length % cU);
  2036. }
  2037. var padding = this.gY(eR, 1);
  2038. for (var i = 0; i < cU; i++) {
  2039. padding[i] = padding[i] ^ cd[i];
  2040. }
  2041. cd = this.eA(fH, padding);
  2042. K(cd, 0, cw, loop * cU, cU);
  2043. return cw;
  2044. },
  2045. kD: function (data, key, cd) {
  2046. if (cd == undefined || cd == null || cd.length % 16 != 0) {
  2047. dB.log("cd is error!");
  2048. return null;
  2049. }
  2050. if (key == undefined || key == null || key.length % 16 != 0) {
  2051. dB.log("dV key is error!");
  2052. return null;
  2053. }
  2054. if (data == undefined || data == null || data.length % 16 != 0) {
  2055. dB.log("data is error!");
  2056. return null;
  2057. }
  2058. var fH = this.hy(key);
  2059. var gW = new Array(32);
  2060. for (var i = 0; i < fH.length; i++) {
  2061. gW[i] = fH[32 - i - 1];
  2062. }
  2063. var cU = 16;
  2064. var loop = data.length / cU;
  2065. var dF = new Array(cU);
  2066. var fh = null;
  2067. var fz = null;
  2068. fz = new Array(data.length);
  2069. for (var i = 0; i < loop; i++) {
  2070. K(data, i * cU, dF, 0, cU);
  2071. fh = this.eA(gW, dF);
  2072. for (var j = 0; j < cU; j++) {
  2073. fh[j] = fh[j] ^ cd[j];
  2074. }
  2075. K(dF, 0, cd, 0, cU);
  2076. K(fh, 0, fz, i * cU, cU);
  2077. }
  2078. var eY = this.gY(fh, 0);
  2079. var gq = new Array(fz.length - cU + eY.length);
  2080. K(fz, 0, gq, 0, fz.length - cU);
  2081. K(eY, 0, gq, fz.length - cU, eY.length);
  2082. return gq;
  2083. }
  2084. };
  2085. function T() {
  2086. this.ft = new Array();
  2087. this.eW = 0;
  2088. this.hB = 0;
  2089. this.hZ = 32;
  2090. this.gU = [0x7380166f, 0x4914b2b9, 0x172442d7, 0xda8a0600, 0xa96f30bc, 0x163138aa, 0xe38dee4d, 0xb0fb0e4e];
  2091. this.gU = [0x7380166f, 0x4914b2b9, 0x172442d7, -628488704, -1452330820, 0x163138aa, -477237683, -1325724082];
  2092. this.v = new Array(8);
  2093. this.jJ = new Array(8);
  2094. this.fU = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
  2095. this.X = new Array(68);
  2096. this.eI = 0;
  2097. this.lw = 0x79cc4519;
  2098. this.lz = 0x7a879d8a;
  2099. if (arguments.length > 0) {
  2100. this.lc(arguments[0]);
  2101. } else {
  2102. this.gD();
  2103. }
  2104. };
  2105. T.prototype = {
  2106. dj: {
  2107. ki: -parseInt('10000000000000000000000000000000', 2),
  2108. ir: parseInt('1111111111111111111111111111111', 2),
  2109. parse: function (n) {
  2110. if (n < this.ki) {
  2111. var fa = new Number(-n);
  2112. var fe = fa.toString(2);
  2113. var dU = fe.substr(fe.length - 31, 31);
  2114. var fC = '';
  2115. for (var i = 0; i < dU.length; i++) {
  2116. var hE = dU.substr(i, 1);
  2117. fC += hE == '0' ? '1' : '0';
  2118. }
  2119. var result = parseInt(fC, 2);
  2120. return (result + 1);
  2121. } else if (n > this.ir) {
  2122. var fa = Number(n);
  2123. var fe = fa.toString(2);
  2124. var dU = fe.substr(fe.length - 31, 31);
  2125. var fC = '';
  2126. for (var i = 0; i < dU.length; i++) {
  2127. var hE = dU.substr(i, 1);
  2128. fC += hE == '0' ? '1' : '0';
  2129. }
  2130. var result = parseInt(fC, 2);
  2131. return -(result + 1);
  2132. } else {
  2133. return n;
  2134. }
  2135. },
  2136. gK: function (n) {
  2137. if (n < 0) {
  2138. var fa = new Number(-n);
  2139. var fe = fa.toString(2);
  2140. var dU = fe.substr(fe.length - 8, 8);
  2141. var fC = '';
  2142. for (var i = 0; i < dU.length; i++) {
  2143. var hE = dU.substr(i, 1);
  2144. fC += hE == '0' ? '1' : '0';
  2145. }
  2146. var result = parseInt(fC, 2);
  2147. return (result + 1);
  2148. } else if (n > 255) {
  2149. var fa = Number(n);
  2150. var fe = fa.toString(2);
  2151. return parseInt(fe.substr(fe.length - 8, 8), 2);
  2152. } else {
  2153. return n;
  2154. }
  2155. }
  2156. },
  2157. gD: function () {
  2158. this.ft = new Array(4);
  2159. this.reset();
  2160. },
  2161. lc: function (t) {
  2162. this.ft = [].concat(t.ft);
  2163. this.eW = t.eW;
  2164. this.hB = t.hB;
  2165. K(t.X, 0, this.X, 0, t.X.length);
  2166. this.eI = t.eI;
  2167. K(t.v, 0, this.v, 0, t.v.length);
  2168. },
  2169. hL: function () {
  2170. return this.hZ;
  2171. },
  2172. reset: function () {
  2173. this.hB = 0;
  2174. this.eW = 0;
  2175. for (var kc in this.ft) this.ft[kc] = null;
  2176. K(this.gU, 0, this.v, 0, this.gU.length);
  2177. this.eI = 0;
  2178. K(this.fU, 0, this.X, 0, this.fU.length);
  2179. },
  2180. hS: function () {
  2181. var i;
  2182. var fs = this.X;
  2183. var gu = new Array(64);
  2184. for (i = 16; i < 68; i++) {
  2185. fs[i] = this.kT(fs[i - 16] ^ fs[i - 9] ^ (this.rotate(fs[i - 3], 15))) ^ (this.rotate(fs[i - 13], 7)) ^ fs[i -
  2186. 6];
  2187. }
  2188. for (i = 0; i < 64; i++) {
  2189. gu[i] = fs[i] ^ fs[i + 4];
  2190. }
  2191. var ej = this.v;
  2192. var dr = this.jJ;
  2193. K(ej, 0, dr, 0, this.gU.length);
  2194. var fj, fV, hI, fQ, fW;
  2195. for (i = 0; i < 16; i++) {
  2196. fW = this.rotate(dr[0], 12);
  2197. fj = this.dj.parse(this.dj.parse(fW + dr[4]) + this.rotate(this.lw, i));
  2198. fj = this.rotate(fj, 7);
  2199. fV = fj ^ fW;
  2200. hI = this.dj.parse(this.dj.parse(this.lu(dr[0], dr[1], dr[2]) + dr[3]) + fV) + gu[i];
  2201. fQ = this.dj.parse(this.dj.parse(this.ky(dr[4], dr[5], dr[6]) + dr[7]) + fj) + fs[i];
  2202. dr[3] = dr[2];
  2203. dr[2] = this.rotate(dr[1], 9);
  2204. dr[1] = dr[0];
  2205. dr[0] = hI;
  2206. dr[7] = dr[6];
  2207. dr[6] = this.rotate(dr[5], 19);
  2208. dr[5] = dr[4];
  2209. dr[4] = this.ii(fQ);
  2210. }
  2211. for (i = 16; i < 64; i++) {
  2212. fW = this.rotate(dr[0], 12);
  2213. fj = this.dj.parse(this.dj.parse(fW + dr[4]) + this.rotate(this.lz, i));
  2214. fj = this.rotate(fj, 7);
  2215. fV = fj ^ fW;
  2216. hI = this.dj.parse(this.dj.parse(this.kk(dr[0], dr[1], dr[2]) + dr[3]) + fV) + gu[i];
  2217. fQ = this.dj.parse(this.dj.parse(this.jL(dr[4], dr[5], dr[6]) + dr[7]) + fj) + fs[i];
  2218. dr[3] = dr[2];
  2219. dr[2] = this.rotate(dr[1], 9);
  2220. dr[1] = dr[0];
  2221. dr[0] = hI;
  2222. dr[7] = dr[6];
  2223. dr[6] = this.rotate(dr[5], 19);
  2224. dr[5] = dr[4];
  2225. dr[4] = this.ii(fQ);
  2226. }
  2227. for (i = 0; i < 8; i++) {
  2228. ej[i] ^= this.dj.parse(dr[i]);
  2229. }
  2230. this.eI = 0;
  2231. K(this.fU, 0, this.X, 0, this.fU.length);
  2232. },
  2233. iC: function (hg, ee) {
  2234. var n = hg[ee] << 24;
  2235. n |= (hg[++ee] & 0xff) << 16;
  2236. n |= (hg[++ee] & 0xff) << 8;
  2237. n |= (hg[++ee] & 0xff);
  2238. this.X[this.eI] = n;
  2239. if (++this.eI == 16) {
  2240. this.hS();
  2241. }
  2242. },
  2243. ly: function (fg) {
  2244. if (this.eI > 14) {
  2245. this.hS();
  2246. }
  2247. this.X[14] = (this.ke(fg, 32));
  2248. this.X[15] = (fg & (0xffffffff));
  2249. },
  2250. kP: function (n, fD, off) {
  2251. fD[off] = this.dj.gK(this.hu(n, 24)) & 0x000000FF;
  2252. fD[++off] = this.dj.gK(this.hu(n, 16)) & 0x000000FF;
  2253. fD[++off] = this.dj.gK(this.hu(n, 8)) & 0x000000FF;
  2254. fD[++off] = this.dj.gK(n) & 0x000000FF;
  2255. },
  2256. gN: function (lm, lv) {
  2257. this.finish();
  2258. for (var i = 0; i < 8; i++) {
  2259. this.kP(this.v[i], lm, lv + i * 4);
  2260. }
  2261. this.reset();
  2262. return this.hZ;
  2263. },
  2264. update: function (input) {
  2265. this.ft[this.eW++] = input;
  2266. if (this.eW == this.ft.length) {
  2267. this.iC(this.ft, 0);
  2268. this.eW = 0;
  2269. }
  2270. this.hB++;
  2271. },
  2272. fc: function (input, ee, length) {
  2273. while ((this.eW != 0) && (length > 0)) {
  2274. this.update(input[ee]);
  2275. ee++;
  2276. length--;
  2277. }
  2278. while (length > this.ft.length) {
  2279. this.iC(input, ee);
  2280. ee += this.ft.length;
  2281. length -= this.ft.length;
  2282. this.hB += this.ft.length;
  2283. }
  2284. while (length > 0) {
  2285. this.update(input[ee]);
  2286. ee++;
  2287. length--;
  2288. }
  2289. },
  2290. finish: function () {
  2291. var fg = (this.hB << 3);
  2292. this.update((128));
  2293. while (this.eW != 0) this.update((0));
  2294. this.ly(fg);
  2295. this.hS();
  2296. },
  2297. rotate: function (x, n) {
  2298. return (x << n) | (this.hu(x, (32 - n)));
  2299. },
  2300. ii: function (X) {
  2301. return ((X) ^ this.rotate((X), 9) ^ this.rotate((X), 17));
  2302. },
  2303. kT: function (X) {
  2304. return ((X) ^ this.rotate((X), 15) ^ this.rotate((X), 23));
  2305. },
  2306. lu: function (X, Y, Z) {
  2307. return (X ^ Y ^ Z);
  2308. },
  2309. kk: function (X, Y, Z) {
  2310. return ((X & Y) | (X & Z) | (Y & Z));
  2311. },
  2312. ky: function (X, Y, Z) {
  2313. return (X ^ Y ^ Z);
  2314. },
  2315. jL: function (X, Y, Z) {
  2316. return ((X & Y) | (~X & Z));
  2317. },
  2318. hu: function (number, fu) {
  2319. if (number > this.dj.ir || number < this.dj.ki) {
  2320. number = this.dj.parse(number);
  2321. }
  2322. if (number >= 0) {
  2323. return number >> fu;
  2324. } else {
  2325. return (number >> fu) + (2 << ~fu);
  2326. }
  2327. },
  2328. ke: function (number, fu) {
  2329. var fR;
  2330. var big = new L();
  2331. big.eT(number);
  2332. if (big.eJ() >= 0) {
  2333. fR = big.ic(fu).hs();
  2334. } else {
  2335. var jm = new L();
  2336. jm.eT(2);
  2337. var iU = ~fu;
  2338. var gh = '';
  2339. if (iU < 0) {
  2340. var jS = 64 + iU;
  2341. for (var i = 0; i < jS; i++) {
  2342. gh += '0';
  2343. }
  2344. var jE = new L();
  2345. jE.eT(number >> fu);
  2346. var jC = new L("10" + gh, 2);
  2347. gh = jC.eD(10);
  2348. var r = jC.add(jE);
  2349. fR = r.eD(10);
  2350. } else {
  2351. gh = jm.shiftLeft((~fu)).hs();
  2352. fR = (number >> fu) + gh;
  2353. }
  2354. }
  2355. return fR;
  2356. },
  2357. jN: function (g, kz) {
  2358. var jf = new Array(32);
  2359. var iz = new Array(32);
  2360. K(kz, 1, jf, 0, 32);
  2361. K(kz, 33, iz, 0, 32);
  2362. var iB = CommonUtils.utf8StrToHex('1234567812345678');
  2363. var dm = iB.length * 4;
  2364. this.update((dm >> 8 & 0x00ff));
  2365. this.update((dm & 0x00ff));
  2366. var ia = this.gB(iB);
  2367. this.fc(ia, 0, ia.length);
  2368. var it = this.gB(g.dP.a.cR().eD(16));
  2369. var ip = this.gB(g.dP.b.cR().eD(16));
  2370. var jl = this.gB(g.fI().cR().eD(16));
  2371. var ie = this.gB(g.ec().cR().eD(16));
  2372. var ig = jf;
  2373. var iu = iz;
  2374. this.fc(it, 0, it.length);
  2375. this.fc(ip, 0, ip.length);
  2376. this.fc(jl, 0, jl.length);
  2377. this.fc(ie, 0, ie.length);
  2378. this.fc(ig, 0, ig.length);
  2379. this.fc(iu, 0, iu.length);
  2380. var hX = new Array(this.hL());
  2381. this.gN(hX, 0);
  2382. return hX;
  2383. },
  2384. gB: function (jq) {
  2385. var eN = [];
  2386. var lp = jq.length;
  2387. for (var i = 0; i < lp; i += 2) {
  2388. eN.push(parseInt(jq.substr(i, 2), 16));
  2389. }
  2390. return eN;
  2391. }
  2392. };
  2393. window.CipherMode = {
  2394. C1C2C3: 0,
  2395. C1C3C2: 1,
  2396. c1c2c3: 0,
  2397. c1c3c2: 1
  2398. };
  2399. function aK(eV, eC) {
  2400. if (typeof (eV) != 'undefined' && eV === 1) {
  2401. this.eV = CipherMode.C1C3C2;
  2402. } else {
  2403. this.eV = CipherMode.C1C2C3;
  2404. }
  2405. if (typeof (eC) != 'undefined' && CommonUtils.isHexString(eC)) {
  2406. this.eC = eC;
  2407. } else {
  2408. this.eC = null;
  2409. }
  2410. this.kQ = new L("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF", 16);
  2411. this.ks = new L("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC", 16);
  2412. this.kG = new L("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93", 16);
  2413. this.eB = new L("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123", 16);
  2414. this.jX = new L("32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7", 16);
  2415. this.kI = new L("BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0", 16);
  2416. this.lK = 256;
  2417. this.jM = new bo();
  2418. this.gZ = new V(this.kQ, this.ks, this.kG);
  2419. this.ha = G.hQ(this.gZ, "04" + this.jX.toString(16) + this.kI.toString(16));
  2420. };
  2421. aK.prototype = {
  2422. jU: function (jo) {
  2423. return new L(jo.fg(), this.jM).cl(jo.cv(L.ONE)).add(L.ONE);
  2424. },
  2425. generateKeyPair: function () {
  2426. var eF = this.jt();
  2427. var cZ = eF['gk'].gv();
  2428. var jd = eF['fb'].fI().cR();
  2429. var jn = eF['fb'].ec().cR();
  2430. var jH = this.fN(jd, 32);
  2431. var lj = this.fN(jn, 32);
  2432. var dC = new Array(65);
  2433. dC[0] = 0x04;
  2434. K(jH, 0, dC, 1, 32);
  2435. K(lj, 0, dC, 33, 32);
  2436. return {
  2437. 'gk': cZ,
  2438. 'fb': dC
  2439. };
  2440. },
  2441. kX: function () {
  2442. var eF = this.generateKeyPair();
  2443. var lo = eF.fb;
  2444. var lA = eF.gk;
  2445. return {
  2446. 'prvkeyhex': CommonUtils.bytesToHex(lA),
  2447. 'pubkeyhex': CommonUtils.bytesToHex(lo)
  2448. };
  2449. },
  2450. jt: function (eC) {
  2451. var iJ = this.eB;
  2452. var gF = null;
  2453. var iV = null;
  2454. if (CommonUtils.isHexString(eC)) {
  2455. gF = new L(eC, 16);
  2456. } else {
  2457. do {
  2458. gF = this.jU(iJ);
  2459. } while (gF.equals(L.ZERO) || gF.dw(iJ) >= 0);
  2460. }
  2461. iV = this.ha.multiply(gF);
  2462. return {
  2463. 'gk': gF,
  2464. "fb": iV
  2465. };
  2466. },
  2467. jR: function (cZ) {
  2468. var hn = this.ha.multiply(new L(CommonUtils.bytesToHex(cZ), 16));
  2469. var x = this.fN(hn.fI().cR(), 32);
  2470. var y = this.fN(hn.ec().cR(), 32);
  2471. var dC = new Array(65);
  2472. dC[0] = 0x04;
  2473. K(x, 0, dC, 1, 32);
  2474. K(y, 0, dC, 33, 32);
  2475. return dC;
  2476. },
  2477. jT: function () {
  2478. var eF = this.jt();
  2479. var jd = eF['fb'].fI().cR();
  2480. var jn = eF['fb'].ec().cR();
  2481. var hn = this.gZ.kU(jd, jn);
  2482. eF.x1 = hn.fI().cR();
  2483. return eF;
  2484. },
  2485. fN: function (kb, hH) {
  2486. var dF = new Array(hH);
  2487. for (var i = 0; i < dF.length; i++) {
  2488. dF[i] = 0;
  2489. }
  2490. var eK = kb.gv();
  2491. if (eK == null) {
  2492. return null;
  2493. }
  2494. if (eK.length > hH) {
  2495. K(eK, eK.length - hH, dF, 0, hH);
  2496. } else if (eK.length == hH) {
  2497. dF = eK;
  2498. } else {
  2499. K(eK, 0, dF, hH - eK.length, eK.length);
  2500. }
  2501. return dF;
  2502. },
  2503. iH: function (eU, data) {
  2504. var loop = Math.ceil(data.length / 32);
  2505. var eP;
  2506. var hash = new Array(32);
  2507. for (var i = 0; i < loop; i++) {
  2508. eP = new T();
  2509. eP.fc(eU, 0, eU.length);
  2510. eP.fc(F(i + 1), 0, 4);
  2511. eP.gN(hash, 0);
  2512. for (var j = 0; j < hash.length && (i * 32 + j) < data.length; j++) {
  2513. data[i * 32 + j] ^= hash[j];
  2514. }
  2515. }
  2516. return 0;
  2517. },
  2518. iO: function (data, dC) {
  2519. var hi = new T();
  2520. var iK = new T().jN(this.ha, dC);
  2521. var hO = data;
  2522. var eQ = new Array(hi.hL());
  2523. hi.fc(iK, 0, iK.length);
  2524. hi.fc(hO, 0, hO.length);
  2525. hi.gN(eQ, 0);
  2526. return eQ;
  2527. },
  2528. er: function (data, cZ, bZ) {
  2529. var dC = this.jR(cZ);
  2530. var eQ = this.iO(data, dC);
  2531. var iE = new L(CommonUtils.bytesToHex(cZ), 16);
  2532. var e = new L(CommonUtils.bytesToHex(eQ), 16);
  2533. var k = null;
  2534. var r = null;
  2535. var s = null;
  2536. do {
  2537. do {
  2538. var ib = this.jT();
  2539. k = ib.gk;
  2540. r = e.add(ib.x1).cl(this.eB);
  2541. } while (r.equals(L.ZERO) || r.add(k).equals(this.eB));
  2542. s = iE.add(L.ONE).fZ(this.eB).multiply(k.cv(r.multiply(iE))).cl(this.eB);
  2543. } while (s.equals(L.ZERO));
  2544. if (typeof (bZ) != 'undefined' && bZ == true) {
  2545. var kx = this.kd(r.gv(), s.gv());
  2546. return kx;
  2547. } else {
  2548. var kO = this.fN(r, 32);
  2549. var jI = this.fN(s, 32);
  2550. return CommonUtils.hexToBytes(CommonUtils.bytesToHex(kO) + CommonUtils.bytesToHex(jI));
  2551. }
  2552. },
  2553. ga: function (data, cB, dC, bZ) {
  2554. var eQ = this.iO(data, dC);
  2555. var r = null;
  2556. var s = null;
  2557. if (typeof (bZ) != 'undefined' && bZ == true) {
  2558. var cN = this.le(cB);
  2559. var hW = new Array(cN["r"].length);
  2560. var iF = new Array(cN["s"].length);
  2561. K(cN["r"], 0, hW, 0, cN["r"].length);
  2562. K(cN["s"], 0, iF, 0, cN["s"].length);
  2563. r = new L(CommonUtils.bytesToHex(hW), 16);
  2564. s = new L(CommonUtils.bytesToHex(iF), 16);
  2565. } else {
  2566. var dW = CommonUtils.bytesToHex(cB);
  2567. r = new L(dW.substring(0, 64), 16);
  2568. s = new L(dW.substring(64), 16);
  2569. }
  2570. var hn = this.gZ.kR(CommonUtils.bytesToHex(dC));
  2571. var e = new L(CommonUtils.bytesToHex(eQ), 16);
  2572. var t = r.add(s).cl(this.eB);
  2573. if (t.equals(L.ZERO)) return false;
  2574. var lB = this.ha.multiply(s).add(hn.multiply(t));
  2575. var R = e.add(lB.fI().cR()).cl(this.eB);
  2576. return r.equals(R);
  2577. },
  2578. gd: function (dC, data, bZ) {
  2579. if (dC == null || dC.length == 0 || data == null || data.length == 0) {
  2580. return null;
  2581. }
  2582. var lq = G.jZ(this.gZ, dC);
  2583. var cL = null;
  2584. var fA = null;
  2585. var x2 = null;
  2586. var y2 = null;
  2587. var ji = this.jt(this.eC);
  2588. fA = ji['fb'];
  2589. var iS = lq.multiply(ji['gk']);
  2590. x2 = this.fN(iS.fI().cR(), 32);
  2591. y2 = this.fN(iS.ec().cR(), 32);
  2592. cL = new Array(data.length);
  2593. K(data, 0, cL, 0, data.length);
  2594. var eU = new Array(x2.length + y2.length);
  2595. K(x2, 0, eU, 0, x2.length);
  2596. K(y2, 0, eU, x2.length, y2.length);
  2597. this.iH(eU, cL);
  2598. var cD = new Array(32);
  2599. var eP = new T();
  2600. eP.fc(x2, 0, x2.length);
  2601. eP.fc(data, 0, data.length);
  2602. eP.fc(y2, 0, y2.length);
  2603. eP.gN(cD, 0);
  2604. if (typeof (bZ) != 'undefined' && bZ == true) {
  2605. var ln = fA.fI().cR().gv();
  2606. var kf = fA.ec().cR().gv();
  2607. var kn = this.kZ(ln, kf, cL, cD);
  2608. return kn;
  2609. } else {
  2610. var dG = this.fN(fA.fI().cR(), 32);
  2611. var cF = this.fN(fA.ec().cR(), 32);
  2612. var cw = new Array(97 + cL.length);
  2613. cw[0] = 0x04;
  2614. K(dG, 0, cw, 1, dG.length);
  2615. K(cF, 0, cw, 1 + dG.length, cF.length);
  2616. if (this.eV === CipherMode.C1C2C3) {
  2617. K(cL, 0, cw, 1 + dG.length + cF.length, cL.length);
  2618. K(cD, 0, cw, 1 + dG.length + cF.length + cL.length, cD.length);
  2619. } else {
  2620. K(cD, 0, cw, 1 + dG.length + cF.length, cD.length);
  2621. K(cL, 0, cw, 1 + dG.length + cF.length + cD.length, cL.length);
  2622. }
  2623. return cw;
  2624. }
  2625. },
  2626. ht: function (cZ, dH, bZ) {
  2627. if (cZ == null || cZ.length == 0 || dH == null || dH.length == 0) {
  2628. return null;
  2629. }
  2630. var fA = new Array(64 + 1);
  2631. var cL = null;
  2632. var cD = new Array(32);
  2633. if (typeof (bZ) != 'undefined' && bZ == true) {
  2634. var cN = this.lh(dH);
  2635. cL = new Array(cN["cL"].length);
  2636. for (var i = 0; i < fA.length; i++) {
  2637. fA[i] = 0;
  2638. }
  2639. fA[0] = 0x04;
  2640. if (cN["dG"].length <= 32) {
  2641. K(cN["dG"], 0, fA, 1 + (32 - cN["dG"].length), cN["dG"].length);
  2642. } else {
  2643. K(cN["dG"], cN["dG"].length - 32, fA, 1, 32);
  2644. }
  2645. if (cN["cF"].length <= 32) {
  2646. K(cN["cF"], 0, fA, 1 + 32 + (32 - cN["cF"].length), cN["cF"].length);
  2647. } else {
  2648. K(cN["cF"], cN["cF"].length - 32, fA, 1 + 32, 32);
  2649. }
  2650. K(cN["cL"], 0, cL, 0, cL.length);
  2651. K(cN["cD"], 0, cD, 0, 32);
  2652. } else {
  2653. cL = new Array(dH.length - 97);
  2654. K(dH, 0, fA, 0, 65);
  2655. if (this.eV === CipherMode.C1C2C3) {
  2656. K(dH, 65, cL, 0, dH.length - 97);
  2657. K(dH, dH.length - 32, cD, 0, 32);
  2658. } else {
  2659. K(dH, 65, cD, 0, 32);
  2660. K(dH, 97, cL, 0, dH.length - 97);
  2661. }
  2662. }
  2663. var lg = G.hQ(this.gZ, CommonUtils.bytesToHex(fA));
  2664. var jc = lg.multiply(new L(CommonUtils.bytesToHex(cZ), 16));
  2665. var x2 = this.fN(jc.fI().cR(), 32);
  2666. var y2 = this.fN(jc.ec().cR(), 32);
  2667. var eU = new Array(x2.length + y2.length);
  2668. K(x2, 0, eU, 0, x2.length);
  2669. K(y2, 0, eU, x2.length, y2.length);
  2670. var jv = new Array(cL.length);
  2671. K(cL, 0, jv, 0, cL.length);
  2672. this.iH(eU, cL);
  2673. if (co(jv, 0, cL, 0, cL.length) == 0) {
  2674. return null;
  2675. }
  2676. var eP = new T();
  2677. var hash = new Array(32);
  2678. eP.fc(x2, 0, x2.length);
  2679. eP.fc(cL, 0, cL.length);
  2680. eP.fc(y2, 0, y2.length);
  2681. eP.gN(hash, 0);
  2682. var hT = CommonUtils.bytesToHex(cD);
  2683. var ix = CommonUtils.bytesToHex(hash);
  2684. if (!hT || !ix || hT != ix) {
  2685. return null;
  2686. }
  2687. return cL;
  2688. },
  2689. kd: function (r, s) {
  2690. var fl = r.length + s.length + 4;
  2691. var ew = [];
  2692. ew[0] = 0x30;
  2693. if (fl < 0x80) {
  2694. ew[1] = fl;
  2695. } else {
  2696. var fp = F(fl);
  2697. var i = 0;
  2698. while (fp[i] == 0 && i < fp.length) {
  2699. i++;
  2700. }
  2701. ew[1] = 0x80 | (fp.length - i);
  2702. for (var j = 2; i < fp.length; i++, j++) {
  2703. ew[j] = fp[i];
  2704. }
  2705. }
  2706. var bZ = new Array(fl + ew.length);
  2707. var cY = 0;
  2708. K(ew, 0, bZ, 0, ew.length);
  2709. cY += ew.length;
  2710. bZ[cY++] = 0x02;
  2711. bZ[cY++] = r.length;
  2712. K(r, 0, bZ, cY, r.length);
  2713. cY += r.length;
  2714. bZ[cY++] = 0x02;
  2715. bZ[cY++] = s.length;
  2716. K(s, 0, bZ, cY, s.length);
  2717. cY += s.length;
  2718. return bZ;
  2719. },
  2720. kZ: function (dG, cF, cL, cD) {
  2721. var fJ = cL.length;
  2722. var dS = [];
  2723. if (fJ < 0x80) {
  2724. dS[0] = 0x04;
  2725. dS[1] = fJ;
  2726. } else {
  2727. dS[0] = 0x04;
  2728. var gs = F(fJ);
  2729. var i = 0;
  2730. while (gs[i] == 0 && i < gs.length) {
  2731. i++;
  2732. }
  2733. dS[1] = 0x80 | (gs.length - i);
  2734. for (var j = 2; i < gs.length; i++, j++) {
  2735. dS[j] = gs[i];
  2736. }
  2737. }
  2738. var fl = dG.length + cF.length + cL.length + cD.length + 6 + dS.length;
  2739. var ew = [];
  2740. ew[0] = 0x30;
  2741. if (fl < 0x80) {
  2742. ew[1] = fl;
  2743. } else {
  2744. var fp = F(fl);
  2745. var i = 0;
  2746. while (fp[i] == 0 && i < fp.length) {
  2747. i++;
  2748. }
  2749. ew[1] = 0x80 | (fp.length - i);
  2750. for (var j = 2; i < fp.length; i++, j++) {
  2751. ew[j] = fp[i];
  2752. }
  2753. }
  2754. var bZ = new Array(fl + ew.length);
  2755. var cY = 0;
  2756. K(ew, 0, bZ, 0, ew.length);
  2757. cY += ew.length;
  2758. bZ[cY++] = 0x02;
  2759. bZ[cY++] = dG.length;
  2760. K(dG, 0, bZ, cY, dG.length);
  2761. cY += dG.length;
  2762. bZ[cY++] = 0x02;
  2763. bZ[cY++] = cF.length;
  2764. K(cF, 0, bZ, cY, cF.length);
  2765. cY += cF.length;
  2766. bZ[cY++] = 0x04;
  2767. bZ[cY++] = cD.length;
  2768. K(cD, 0, bZ, cY, cD.length);
  2769. cY += cD.length;
  2770. K(dS, 0, bZ, cY, dS.length);
  2771. cY += dS.length;
  2772. K(cL, 0, bZ, cY, cL.length);
  2773. return bZ;
  2774. },
  2775. le: function (bZ) {
  2776. var pos = 0;
  2777. if (bZ[pos++] != 0x30) {
  2778. return null;
  2779. }
  2780. if ((bZ[pos] & 0xFF) <= 0x7F) {
  2781. pos++;
  2782. } else {
  2783. pos += (bZ[pos] & 0x7F) + 1;
  2784. }
  2785. pos++;
  2786. var fX = bZ[pos];
  2787. var r = new Array(fX);
  2788. K(bZ, ++pos, r, 0, fX);
  2789. pos += fX;
  2790. pos++;
  2791. var he = bZ[pos];
  2792. var s = new Array(he);
  2793. K(bZ, ++pos, s, 0, he);
  2794. pos += he;
  2795. return {
  2796. 'r': r,
  2797. "s": s
  2798. };
  2799. },
  2800. lh: function (bZ) {
  2801. var pos = 0;
  2802. if (bZ[pos++] != 0x30) {
  2803. return null;
  2804. }
  2805. if ((bZ[pos] & 0xFF) <= 0x7F) {
  2806. pos++;
  2807. } else {
  2808. pos += (bZ[pos] & 0x7F) + 1;
  2809. }
  2810. pos++;
  2811. var jk = bZ[pos];
  2812. var dG = new Array(jk);
  2813. K(bZ, ++pos, dG, 0, jk);
  2814. pos += jk;
  2815. pos++;
  2816. var iX = bZ[pos];
  2817. var cF = new Array(iX);
  2818. K(bZ, ++pos, cF, 0, iX);
  2819. pos += iX;
  2820. pos++;
  2821. var jD = bZ[pos];
  2822. var cD = new Array(jD);
  2823. K(bZ, ++pos, cD, 0, jD);
  2824. pos += jD;
  2825. pos++;
  2826. var fJ = 0;
  2827. if ((bZ[pos] & 0xFF) <= 0x7F) {
  2828. fJ = bZ[pos] & 0xFF;
  2829. } else {
  2830. for (var i = 0, j = (bZ[pos] & 0x7F) - 1; i < (bZ[pos] & 0x7F); i++, j--) {
  2831. fJ = fJ | ((bZ[pos + i + 1] & 0xFF) << (j * 8));
  2832. }
  2833. pos += (bZ[pos] & 0x7F);
  2834. }
  2835. var cL = new Array(fJ);
  2836. K(bZ, ++pos, cL, 0, fJ);
  2837. pos += fJ;
  2838. return {
  2839. 'dG': dG,
  2840. "cF": cF,
  2841. "cL": cL,
  2842. "cD": cD
  2843. };
  2844. }
  2845. };
  2846. function bL() { };
  2847. bL.prototype = {
  2848. source: function (source) {
  2849. if (!source) {
  2850. dB.error("source is empty!");
  2851. return false;
  2852. } else {
  2853. return true;
  2854. }
  2855. },
  2856. fd: function (eS) {
  2857. if (typeof (eS) == 'undefined') {
  2858. dB.error("eS type undefined!");
  2859. } else if (eS instanceof Array) {
  2860. eS = CommonUtils.bytesToHex(eS);
  2861. }
  2862. if (this.ge(eS, "04") && eS.length == 130) {
  2863. return true;
  2864. } else {
  2865. dB.error("eS length error!");
  2866. return false;
  2867. }
  2868. },
  2869. fo: function (fM) {
  2870. if (typeof (fM) == 'undefined') {
  2871. dB.error("fM type undefined!");
  2872. } else if (fM instanceof Array) {
  2873. fM = CommonUtils.bytesToHex(fM);
  2874. }
  2875. if (fM.length % 2 == 0) {
  2876. return true;
  2877. } else {
  2878. dB.error("fM length error!");
  2879. return false;
  2880. }
  2881. },
  2882. gp: function (cw) {
  2883. if (typeof (cw) == 'undefined') {
  2884. dB.error("cw type undefined!");
  2885. } else if (cw instanceof Array) {
  2886. cw = CommonUtils.bytesToHex(cw);
  2887. }
  2888. if (this.ge(cw, "04") && cw.length % 2 == 0 && cw.length > 194) {
  2889. return true;
  2890. } else if (this.ge(cw, "30") && cw.length % 2 == 0 && cw.length > 216) {
  2891. return true;
  2892. } else {
  2893. dB.error("cw format jw length error!");
  2894. return false;
  2895. }
  2896. },
  2897. fP: function (er) {
  2898. if (typeof (er) == 'undefined') {
  2899. dB.error("er type undefined!");
  2900. } else if (er instanceof Array) {
  2901. er = CommonUtils.bytesToHex(er);
  2902. }
  2903. if (er.length == 128) {
  2904. return true;
  2905. } else if (this.ge(er, "30") && er.length % 2 == 0) {
  2906. return true;
  2907. } else {
  2908. dB.error("er format jw length error!");
  2909. return false;
  2910. }
  2911. },
  2912. fF: function (key) {
  2913. if (typeof (key) == 'undefined') {
  2914. dB.error("key type undefined!");
  2915. } else if (key instanceof Array) {
  2916. key = CommonUtils.bytesToHex(key);
  2917. }
  2918. if (key.length == 32) {
  2919. return true;
  2920. } else {
  2921. dB.error("key length error!");
  2922. return false;
  2923. }
  2924. },
  2925. hj: function (cd) {
  2926. if (typeof (cd) == 'undefined') {
  2927. dB.error("cd type undefined!");
  2928. } else if (cd instanceof Array) {
  2929. cd = CommonUtils.bytesToHex(cd);
  2930. }
  2931. if (cd.length == 32) {
  2932. return true;
  2933. } else {
  2934. dB.error("cd length error!");
  2935. return false;
  2936. }
  2937. },
  2938. hd: function (cw) {
  2939. if (typeof (cw) == 'undefined') {
  2940. dB.error("cw type undefined!");
  2941. } else if (cw instanceof Array) {
  2942. cw = CommonUtils.bytesToHex(cw);
  2943. }
  2944. if (cw && cw.length % 16 == 0) {
  2945. return true;
  2946. } else {
  2947. dB.error("cw format jw length error!");
  2948. return false;
  2949. }
  2950. },
  2951. ge: function (fL, start) {
  2952. var reg = new RegExp("^" + start);
  2953. return reg.test(fL);
  2954. }
  2955. };
  2956. function Sm2Utils(eV, eC) {
  2957. if (typeof (eV) != 'undefined') {
  2958. this.eV = eV;
  2959. } else {
  2960. this.eV = CipherMode.C1C2C3;
  2961. }
  2962. if (typeof (eC) != 'undefined' && CommonUtils.isHexString(eC)) {
  2963. this.eC = eC;
  2964. } else {
  2965. this.eC = null;
  2966. }
  2967. this.cw = new aK(this.eV, this.eC);
  2968. this.smValidate = new bL();
  2969. };
  2970. Sm2Utils.prototype = {
  2971. generateKeyPair: function () {
  2972. return this.cw.kX();
  2973. },
  2974. getPublicKey: function (kL) {
  2975. var cZ = CommonUtils.hexToBytes(kL);
  2976. var dC = this.cw.jR(cZ);
  2977. return CommonUtils.bytesToHex(dC);
  2978. },
  2979. encryptFromText: function (cV, cb) {
  2980. if (!this.smValidate.fd(cV)) {
  2981. return null;
  2982. }
  2983. if (!this.smValidate.source(cb)) {
  2984. return null;
  2985. }
  2986. var dC = CommonUtils.hexToBytes(cV);
  2987. var cu = CommonUtils.utf8StrToBytes(cb);
  2988. var dH = this.cw.gd(dC, cu, false);
  2989. return CommonUtils.bytesToHex(dH);
  2990. },
  2991. decryptToText: function (du, cE) {
  2992. if (!this.smValidate.fo(du)) {
  2993. return null;
  2994. }
  2995. if (!this.smValidate.gp(cE)) {
  2996. return null;
  2997. }
  2998. var cZ = CommonUtils.hexToBytes(du);
  2999. var dH = CommonUtils.hexToBytes(cE);
  3000. var cu = this.cw.ht(cZ, dH, false);
  3001. return CommonUtils.bytesToUtf8Str(cu);
  3002. },
  3003. encryptFromHex: function (cV, dO) {
  3004. if (!this.smValidate.fd(cV)) {
  3005. return null;
  3006. }
  3007. if (!this.smValidate.source(dO)) {
  3008. return null;
  3009. }
  3010. var dC = CommonUtils.hexToBytes(cV);
  3011. var cu = CommonUtils.hexToBytes(dO);
  3012. var dH = this.cw.gd(dC, cu, false);
  3013. return CommonUtils.bytesToHex(dH);
  3014. },
  3015. decryptToHex: function (du, cE) {
  3016. if (!this.smValidate.fo(du)) {
  3017. return null;
  3018. }
  3019. if (!this.smValidate.gp(cE)) {
  3020. return null;
  3021. }
  3022. var cZ = CommonUtils.hexToBytes(du);
  3023. var dH = CommonUtils.hexToBytes(cE);
  3024. var cu = this.cw.ht(cZ, dH, false);
  3025. return CommonUtils.bytesToHex(cu);
  3026. },
  3027. encryptFromData: function (dC, cu) {
  3028. if (!this.smValidate.fd(dC)) {
  3029. return null;
  3030. }
  3031. if (!this.smValidate.source(cu)) {
  3032. return null;
  3033. }
  3034. return this.cw.gd(dC, cu, false);
  3035. },
  3036. decryptToData: function (cZ, dH) {
  3037. if (!this.smValidate.fo(cZ)) {
  3038. return null;
  3039. }
  3040. if (!this.smValidate.gp(dH)) {
  3041. return null;
  3042. }
  3043. return this.cw.ht(cZ, dH, false);
  3044. },
  3045. encryptASN1FromText: function (cV, cb) {
  3046. if (!this.smValidate.fd(cV)) {
  3047. return null;
  3048. }
  3049. if (!this.smValidate.source(cb)) {
  3050. return null;
  3051. }
  3052. var dC = CommonUtils.hexToBytes(cV);
  3053. var cu = CommonUtils.utf8StrToBytes(cb);
  3054. var dH = this.cw.gd(dC, cu, true);
  3055. return CommonUtils.bytesToHex(dH);
  3056. },
  3057. decryptASN1ToText: function (du, cE) {
  3058. if (!this.smValidate.fo(du)) {
  3059. return null;
  3060. }
  3061. if (!this.smValidate.gp(cE)) {
  3062. return null;
  3063. }
  3064. var cZ = CommonUtils.hexToBytes(du);
  3065. var dH = CommonUtils.hexToBytes(cE);
  3066. var cu = this.cw.ht(cZ, dH, true);
  3067. return CommonUtils.bytesToUtf8Str(cu);
  3068. },
  3069. encryptASN1FromHex: function (cV, dO) {
  3070. if (!this.smValidate.fd(cV)) {
  3071. return null;
  3072. }
  3073. if (!this.smValidate.source(dO)) {
  3074. return null;
  3075. }
  3076. var dC = CommonUtils.hexToBytes(cV);
  3077. var cu = CommonUtils.hexToBytes(dO);
  3078. var dH = this.cw.gd(dC, cu, true);
  3079. return CommonUtils.bytesToHex(dH);
  3080. },
  3081. decryptASN1ToHex: function (du, cE) {
  3082. if (!this.smValidate.fo(du)) {
  3083. return null;
  3084. }
  3085. if (!this.smValidate.gp(cE)) {
  3086. return null;
  3087. }
  3088. var cZ = CommonUtils.hexToBytes(du);
  3089. var dH = CommonUtils.hexToBytes(cE);
  3090. var cu = this.cw.ht(cZ, dH, true);
  3091. return CommonUtils.bytesToHex(cu);
  3092. },
  3093. encryptASN1FromData: function (dC, cu) {
  3094. if (!this.smValidate.fd(dC)) {
  3095. return null;
  3096. }
  3097. if (!this.smValidate.source(cu)) {
  3098. return null;
  3099. }
  3100. return this.cw.gd(dC, cu, true);
  3101. },
  3102. decryptASN1ToData: function (cZ, dH) {
  3103. if (!this.smValidate.fo(cZ)) {
  3104. return null;
  3105. }
  3106. if (!this.smValidate.gp(dH)) {
  3107. return null;
  3108. }
  3109. return this.cw.ht(cZ, dH, true);
  3110. },
  3111. signFromText: function (du, cb) {
  3112. if (!this.smValidate.fo(du)) {
  3113. return null;
  3114. }
  3115. if (!this.smValidate.source(cb)) {
  3116. return null;
  3117. }
  3118. var cZ = CommonUtils.hexToBytes(du);
  3119. var cu = CommonUtils.utf8StrToBytes(cb);
  3120. var cB = this.cw.er(cu, cZ, false);
  3121. return CommonUtils.bytesToHex(cB);
  3122. },
  3123. verifySignFromText: function (cV, cb, dW) {
  3124. if (!this.smValidate.fd(cV)) {
  3125. return null;
  3126. }
  3127. if (!this.smValidate.source(cb)) {
  3128. return null;
  3129. }
  3130. if (!this.smValidate.fP(dW)) {
  3131. return null;
  3132. }
  3133. var dC = CommonUtils.hexToBytes(cV);
  3134. var cu = CommonUtils.utf8StrToBytes(cb);
  3135. var cB = CommonUtils.hexToBytes(dW);
  3136. return this.cw.ga(cu, cB, dC, false);
  3137. },
  3138. signFromHex: function (du, dO) {
  3139. if (!this.smValidate.fo(du)) {
  3140. return null;
  3141. }
  3142. if (!this.smValidate.source(dO)) {
  3143. return null;
  3144. }
  3145. var cZ = CommonUtils.hexToBytes(du);
  3146. var cu = CommonUtils.hexToBytes(dO);
  3147. var cB = this.cw.er(cu, cZ, false);
  3148. return CommonUtils.bytesToHex(cB);
  3149. },
  3150. verifySignFromHex: function (cV, dO, dW) {
  3151. if (!this.smValidate.fd(cV)) {
  3152. return null;
  3153. }
  3154. if (!this.smValidate.source(dO)) {
  3155. return null;
  3156. }
  3157. if (!this.smValidate.fP(dW)) {
  3158. return null;
  3159. }
  3160. var dC = CommonUtils.hexToBytes(cV);
  3161. var cu = CommonUtils.hexToBytes(dO);
  3162. var cB = CommonUtils.hexToBytes(dW);
  3163. return this.cw.ga(cu, cB, dC, false);
  3164. },
  3165. signFromData: function (cZ, cu) {
  3166. if (!this.smValidate.fo(cZ)) {
  3167. return null;
  3168. }
  3169. if (!this.smValidate.source(cu)) {
  3170. return null;
  3171. }
  3172. return this.cw.er(cu, cZ, false);
  3173. },
  3174. verifySignFromData: function (dC, cu, cB) {
  3175. if (!this.smValidate.fd(dC)) {
  3176. return null;
  3177. }
  3178. if (!this.smValidate.source(cu)) {
  3179. return null;
  3180. }
  3181. if (!this.smValidate.fP(cB)) {
  3182. return null;
  3183. }
  3184. return this.cw.ga(cu, cB, dC, false);
  3185. },
  3186. signASN1FromText: function (du, cb) {
  3187. if (!this.smValidate.fo(du)) {
  3188. return null;
  3189. }
  3190. if (!this.smValidate.source(cb)) {
  3191. return null;
  3192. }
  3193. var cZ = CommonUtils.hexToBytes(du);
  3194. var cu = CommonUtils.utf8StrToBytes(cb);
  3195. var cB = this.cw.er(cu, cZ, true);
  3196. return CommonUtils.bytesToHex(cB);
  3197. },
  3198. verifySignASN1FromText: function (cV, cb, dW) {
  3199. if (!this.smValidate.fd(cV)) {
  3200. return null;
  3201. }
  3202. if (!this.smValidate.source(cb)) {
  3203. return null;
  3204. }
  3205. if (!this.smValidate.fP(dW)) {
  3206. return null;
  3207. }
  3208. var dC = CommonUtils.hexToBytes(cV);
  3209. var cu = CommonUtils.utf8StrToBytes(cb);
  3210. var cB = CommonUtils.hexToBytes(dW);
  3211. return this.cw.ga(cu, cB, dC, true);
  3212. },
  3213. signASN1FromHex: function (du, dO) {
  3214. if (!this.smValidate.fo(du)) {
  3215. return null;
  3216. }
  3217. if (!this.smValidate.source(dO)) {
  3218. return null;
  3219. }
  3220. var cZ = CommonUtils.hexToBytes(du);
  3221. var cu = CommonUtils.hexToBytes(dO);
  3222. var cB = this.cw.er(cu, cZ, true);
  3223. return CommonUtils.bytesToHex(cB);
  3224. },
  3225. verifySignASN1FromHex: function (cV, dO, dW) {
  3226. if (!this.smValidate.fd(cV)) {
  3227. return null;
  3228. }
  3229. if (!this.smValidate.source(dO)) {
  3230. return null;
  3231. }
  3232. if (!this.smValidate.fP(dW)) {
  3233. return null;
  3234. }
  3235. var dC = CommonUtils.hexToBytes(cV);
  3236. var cu = CommonUtils.hexToBytes(dO);
  3237. var cB = CommonUtils.hexToBytes(dW);
  3238. return this.cw.ga(cu, cB, dC, true);
  3239. },
  3240. signASN1FromData: function (cZ, cu) {
  3241. if (!this.smValidate.fo(cZ)) {
  3242. return null;
  3243. }
  3244. if (!this.smValidate.source(cu)) {
  3245. return null;
  3246. }
  3247. return this.cw.er(cu, cZ, true);
  3248. },
  3249. verifySignASN1FromData: function (dC, cu, cB) {
  3250. if (!this.smValidate.fd(dC)) {
  3251. return null;
  3252. }
  3253. if (!this.smValidate.source(cu)) {
  3254. return null;
  3255. }
  3256. if (!this.smValidate.fP(cB)) {
  3257. return null;
  3258. }
  3259. return this.cw.ga(cu, cB, dC, true);
  3260. }
  3261. };
  3262. var Sm3Utils = {
  3263. smValidate: new bL(),
  3264. encryptFromText: function (cb) {
  3265. if (!this.smValidate.source(cb)) {
  3266. return null;
  3267. }
  3268. var cu = CommonUtils.utf8StrToBytes(cb);
  3269. var eQ = this.encryptFromData(cu);
  3270. return CommonUtils.bytesToHex(eQ);
  3271. },
  3272. encryptFromHex: function (dO) {
  3273. if (!this.smValidate.source(dO)) {
  3274. return null;
  3275. }
  3276. var cu = CommonUtils.hexToBytes(dO);
  3277. var eQ = this.encryptFromData(cu);
  3278. return CommonUtils.bytesToHex(eQ);
  3279. },
  3280. encryptFromData: function (cu) {
  3281. if (!this.smValidate.source(cu)) {
  3282. return null;
  3283. }
  3284. var eQ = new Array(32);
  3285. var jy = new T();
  3286. jy.fc(cu, 0, cu.length);
  3287. jy.gN(eQ, 0);
  3288. return eQ;
  3289. }
  3290. };
  3291. var Sm4Utils = {
  3292. ECB: {
  3293. smValidate: new bL(),
  3294. encryptFromText: function (cb, dz) {
  3295. if (!this.smValidate.source(cb)) {
  3296. return null;
  3297. }
  3298. if (!this.smValidate.fF(dz)) {
  3299. return null;
  3300. }
  3301. var cK = CommonUtils.hexToBytes(dz);
  3302. var cu = CommonUtils.utf8StrToBytes(cb);
  3303. var dH = this.encryptFromData(cu, cK);
  3304. return CommonUtils.bytesToHex(dH);
  3305. },
  3306. encryptFromHex: function (dO, dz) {
  3307. if (!this.smValidate.source(dO)) {
  3308. return null;
  3309. }
  3310. if (!this.smValidate.fF(dz)) {
  3311. return null;
  3312. }
  3313. var cK = CommonUtils.hexToBytes(dz);
  3314. var cu = CommonUtils.hexToBytes(dO);
  3315. var dH = this.encryptFromData(cu, cK);
  3316. return CommonUtils.bytesToHex(dH);
  3317. },
  3318. encryptFromData: function (cu, cK) {
  3319. if (!this.smValidate.source(cu)) {
  3320. return null;
  3321. }
  3322. if (!this.smValidate.fF(cK)) {
  3323. return null;
  3324. }
  3325. try {
  3326. var dV = new aP();
  3327. return dV.lk(cu, cK);
  3328. } catch (e) {
  3329. dB.error(e);
  3330. return null;
  3331. }
  3332. },
  3333. decryptToText: function (cE, dz) {
  3334. if (!this.smValidate.hd(cE)) {
  3335. return null;
  3336. }
  3337. if (!this.smValidate.fF(dz)) {
  3338. return null;
  3339. }
  3340. var cK = CommonUtils.hexToBytes(dz);
  3341. var dH = CommonUtils.hexToBytes(cE);
  3342. var cu = this.decryptToData(dH, cK);
  3343. return CommonUtils.bytesToUtf8Str(cu);
  3344. },
  3345. decryptToHex: function (cE, dz) {
  3346. if (!this.smValidate.hd(cE)) {
  3347. return null;
  3348. }
  3349. if (!this.smValidate.fF(dz)) {
  3350. return null;
  3351. }
  3352. var cK = CommonUtils.hexToBytes(dz);
  3353. var dH = CommonUtils.hexToBytes(cE);
  3354. var cu = this.decryptToData(dH, cK);
  3355. return CommonUtils.bytesToHex(cu);
  3356. },
  3357. decryptToData: function (dH, cK) {
  3358. if (!this.smValidate.hd(dH)) {
  3359. return null;
  3360. }
  3361. if (!this.smValidate.fF(cK)) {
  3362. return null;
  3363. }
  3364. try {
  3365. var dV = new aP();
  3366. return dV.kY(dH, cK);
  3367. } catch (e) {
  3368. dB.error(e);
  3369. return null;
  3370. }
  3371. }
  3372. },
  3373. CBC: {
  3374. smValidate: new bL(),
  3375. encryptFromText: function (cb, dz, dZ) {
  3376. if (!this.smValidate.source(cb)) {
  3377. return null;
  3378. }
  3379. if (!this.smValidate.fF(dz)) {
  3380. return null;
  3381. }
  3382. if (!this.smValidate.hj(dZ)) {
  3383. return null;
  3384. }
  3385. var cK = CommonUtils.hexToBytes(dz);
  3386. var fq = CommonUtils.hexToBytes(dZ);
  3387. var cu = CommonUtils.utf8StrToBytes(cb);
  3388. var dH = this.encryptFromData(cu, cK, fq);
  3389. return CommonUtils.bytesToHex(dH);
  3390. },
  3391. encryptFromHex: function (dO, dz, dZ) {
  3392. if (!this.smValidate.source(dO)) {
  3393. return null;
  3394. }
  3395. if (!this.smValidate.fF(dz)) {
  3396. return null;
  3397. }
  3398. if (!this.smValidate.hj(dZ)) {
  3399. return null;
  3400. }
  3401. var cK = CommonUtils.hexToBytes(dz);
  3402. var fq = CommonUtils.hexToBytes(dZ);
  3403. var cu = CommonUtils.hexToBytes(dO);
  3404. var dH = this.encryptFromData(cu, cK, fq);
  3405. return CommonUtils.bytesToHex(dH);
  3406. },
  3407. encryptFromData: function (cu, cK, fq) {
  3408. if (!this.smValidate.source(cu)) {
  3409. return null;
  3410. }
  3411. if (!this.smValidate.fF(cK)) {
  3412. return null;
  3413. }
  3414. if (!this.smValidate.hj(fq)) {
  3415. return null;
  3416. }
  3417. try {
  3418. var dV = new aP();
  3419. return dV.ll(cu, cK, fq);
  3420. } catch (e) {
  3421. dB.error(e);
  3422. return null;
  3423. }
  3424. },
  3425. decryptToText: function (cE, dz, dZ) {
  3426. if (!this.smValidate.hd(cE)) {
  3427. return null;
  3428. }
  3429. if (!this.smValidate.fF(dz)) {
  3430. return null;
  3431. }
  3432. if (!this.smValidate.hj(dZ)) {
  3433. return null;
  3434. }
  3435. var cK = CommonUtils.hexToBytes(dz);
  3436. var fq = CommonUtils.hexToBytes(dZ);
  3437. var dH = CommonUtils.hexToBytes(cE);
  3438. var cu = this.decryptToData(dH, cK, fq);
  3439. return CommonUtils.bytesToUtf8Str(cu);
  3440. },
  3441. decryptToHex: function (cE, dz, dZ) {
  3442. if (!this.smValidate.hd(cE)) {
  3443. return null;
  3444. }
  3445. if (!this.smValidate.fF(dz)) {
  3446. return null;
  3447. }
  3448. if (!this.smValidate.hj(dZ)) {
  3449. return null;
  3450. }
  3451. var cK = CommonUtils.hexToBytes(dz);
  3452. var fq = CommonUtils.hexToBytes(dZ);
  3453. var dH = CommonUtils.hexToBytes(cE);
  3454. var cu = this.decryptToData(dH, cK, fq);
  3455. return CommonUtils.bytesToHex(cu);
  3456. },
  3457. decryptToData: function (dH, cK, fq) {
  3458. if (!this.smValidate.hd(dH)) {
  3459. return null;
  3460. }
  3461. if (!this.smValidate.fF(cK)) {
  3462. return null;
  3463. }
  3464. if (!this.smValidate.hj(fq)) {
  3465. return null;
  3466. }
  3467. try {
  3468. var dV = new aP();
  3469. return dV.kD(dH, cK, fq);
  3470. } catch (e) {
  3471. dB.error(e);
  3472. return null;
  3473. }
  3474. }
  3475. }
  3476. };
  3477. // export {
  3478. // Sm3Utils,
  3479. // Sm4Utils,
  3480. // Sm2Utils
  3481. // }
  3482. Sm3Utils,
  3483. Sm4Utils,
  3484. Sm2Utils