index.js 238 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365
  1. module.exports = (function() {
  2. var __MODS__ = {};
  3. var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
  4. var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
  5. var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
  6. var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
  7. __DEFINE__(1733984946566, function(require, module, exports) {
  8. ;(function (root, factory, undef) {
  9. if (typeof exports === "object") {
  10. // CommonJS
  11. module.exports = exports = factory(require("./core"), require("./x64-core"), require("./lib-typedarrays"), require("./enc-utf16"), require("./enc-base64"), require("./enc-base64url"), require("./md5"), require("./sha1"), require("./sha256"), require("./sha224"), require("./sha512"), require("./sha384"), require("./sha3"), require("./ripemd160"), require("./hmac"), require("./pbkdf2"), require("./evpkdf"), require("./cipher-core"), require("./mode-cfb"), require("./mode-ctr"), require("./mode-ctr-gladman"), require("./mode-ofb"), require("./mode-ecb"), require("./pad-ansix923"), require("./pad-iso10126"), require("./pad-iso97971"), require("./pad-zeropadding"), require("./pad-nopadding"), require("./format-hex"), require("./aes"), require("./tripledes"), require("./rc4"), require("./rabbit"), require("./rabbit-legacy"), require("./blowfish"));
  12. }
  13. else if (typeof define === "function" && define.amd) {
  14. // AMD
  15. define(["./core", "./x64-core", "./lib-typedarrays", "./enc-utf16", "./enc-base64", "./enc-base64url", "./md5", "./sha1", "./sha256", "./sha224", "./sha512", "./sha384", "./sha3", "./ripemd160", "./hmac", "./pbkdf2", "./evpkdf", "./cipher-core", "./mode-cfb", "./mode-ctr", "./mode-ctr-gladman", "./mode-ofb", "./mode-ecb", "./pad-ansix923", "./pad-iso10126", "./pad-iso97971", "./pad-zeropadding", "./pad-nopadding", "./format-hex", "./aes", "./tripledes", "./rc4", "./rabbit", "./rabbit-legacy", "./blowfish"], factory);
  16. }
  17. else {
  18. // Global (browser)
  19. root.CryptoJS = factory(root.CryptoJS);
  20. }
  21. }(this, function (CryptoJS) {
  22. return CryptoJS;
  23. }));
  24. }, function(modId) {var map = {"./core":1733984946567,"./x64-core":1733984946568,"./lib-typedarrays":1733984946569,"./enc-utf16":1733984946570,"./enc-base64":1733984946571,"./enc-base64url":1733984946572,"./md5":1733984946573,"./sha1":1733984946574,"./sha256":1733984946575,"./sha224":1733984946576,"./sha512":1733984946577,"./sha384":1733984946578,"./sha3":1733984946579,"./ripemd160":1733984946580,"./hmac":1733984946581,"./pbkdf2":1733984946582,"./evpkdf":1733984946583,"./cipher-core":1733984946584,"./mode-cfb":1733984946585,"./mode-ctr":1733984946586,"./mode-ctr-gladman":1733984946587,"./mode-ofb":1733984946588,"./mode-ecb":1733984946589,"./pad-ansix923":1733984946590,"./pad-iso10126":1733984946591,"./pad-iso97971":1733984946592,"./pad-zeropadding":1733984946593,"./pad-nopadding":1733984946594,"./format-hex":1733984946595,"./aes":1733984946596,"./tripledes":1733984946597,"./rc4":1733984946598,"./rabbit":1733984946599,"./rabbit-legacy":1733984946600,"./blowfish":1733984946601}; return __REQUIRE__(map[modId], modId); })
  25. __DEFINE__(1733984946567, function(require, module, exports) {
  26. ;(function (root, factory) {
  27. if (typeof exports === "object") {
  28. // CommonJS
  29. module.exports = exports = factory();
  30. }
  31. else if (typeof define === "function" && define.amd) {
  32. // AMD
  33. define([], factory);
  34. }
  35. else {
  36. // Global (browser)
  37. root.CryptoJS = factory();
  38. }
  39. }(this, function () {
  40. /*globals window, global, require*/
  41. /**
  42. * CryptoJS core components.
  43. */
  44. var CryptoJS = CryptoJS || (function (Math, undefined) {
  45. var crypto;
  46. // Native crypto from window (Browser)
  47. if (typeof window !== 'undefined' && window.crypto) {
  48. crypto = window.crypto;
  49. }
  50. // Native crypto in web worker (Browser)
  51. if (typeof self !== 'undefined' && self.crypto) {
  52. crypto = self.crypto;
  53. }
  54. // Native crypto from worker
  55. if (typeof globalThis !== 'undefined' && globalThis.crypto) {
  56. crypto = globalThis.crypto;
  57. }
  58. // Native (experimental IE 11) crypto from window (Browser)
  59. if (!crypto && typeof window !== 'undefined' && window.msCrypto) {
  60. crypto = window.msCrypto;
  61. }
  62. // Native crypto from global (NodeJS)
  63. if (!crypto && typeof global !== 'undefined' && global.crypto) {
  64. crypto = global.crypto;
  65. }
  66. // Native crypto import via require (NodeJS)
  67. if (!crypto && typeof require === 'function') {
  68. try {
  69. crypto = require('crypto');
  70. } catch (err) {}
  71. }
  72. /*
  73. * Cryptographically secure pseudorandom number generator
  74. *
  75. * As Math.random() is cryptographically not safe to use
  76. */
  77. var cryptoSecureRandomInt = function () {
  78. if (crypto) {
  79. // Use getRandomValues method (Browser)
  80. if (typeof crypto.getRandomValues === 'function') {
  81. try {
  82. return crypto.getRandomValues(new Uint32Array(1))[0];
  83. } catch (err) {}
  84. }
  85. // Use randomBytes method (NodeJS)
  86. if (typeof crypto.randomBytes === 'function') {
  87. try {
  88. return crypto.randomBytes(4).readInt32LE();
  89. } catch (err) {}
  90. }
  91. }
  92. throw new Error('Native crypto module could not be used to get secure random number.');
  93. };
  94. /*
  95. * Local polyfill of Object.create
  96. */
  97. var create = Object.create || (function () {
  98. function F() {}
  99. return function (obj) {
  100. var subtype;
  101. F.prototype = obj;
  102. subtype = new F();
  103. F.prototype = null;
  104. return subtype;
  105. };
  106. }());
  107. /**
  108. * CryptoJS namespace.
  109. */
  110. var C = {};
  111. /**
  112. * Library namespace.
  113. */
  114. var C_lib = C.lib = {};
  115. /**
  116. * Base object for prototypal inheritance.
  117. */
  118. var Base = C_lib.Base = (function () {
  119. return {
  120. /**
  121. * Creates a new object that inherits from this object.
  122. *
  123. * @param {Object} overrides Properties to copy into the new object.
  124. *
  125. * @return {Object} The new object.
  126. *
  127. * @static
  128. *
  129. * @example
  130. *
  131. * var MyType = CryptoJS.lib.Base.extend({
  132. * field: 'value',
  133. *
  134. * method: function () {
  135. * }
  136. * });
  137. */
  138. extend: function (overrides) {
  139. // Spawn
  140. var subtype = create(this);
  141. // Augment
  142. if (overrides) {
  143. subtype.mixIn(overrides);
  144. }
  145. // Create default initializer
  146. if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
  147. subtype.init = function () {
  148. subtype.$super.init.apply(this, arguments);
  149. };
  150. }
  151. // Initializer's prototype is the subtype object
  152. subtype.init.prototype = subtype;
  153. // Reference supertype
  154. subtype.$super = this;
  155. return subtype;
  156. },
  157. /**
  158. * Extends this object and runs the init method.
  159. * Arguments to create() will be passed to init().
  160. *
  161. * @return {Object} The new object.
  162. *
  163. * @static
  164. *
  165. * @example
  166. *
  167. * var instance = MyType.create();
  168. */
  169. create: function () {
  170. var instance = this.extend();
  171. instance.init.apply(instance, arguments);
  172. return instance;
  173. },
  174. /**
  175. * Initializes a newly created object.
  176. * Override this method to add some logic when your objects are created.
  177. *
  178. * @example
  179. *
  180. * var MyType = CryptoJS.lib.Base.extend({
  181. * init: function () {
  182. * // ...
  183. * }
  184. * });
  185. */
  186. init: function () {
  187. },
  188. /**
  189. * Copies properties into this object.
  190. *
  191. * @param {Object} properties The properties to mix in.
  192. *
  193. * @example
  194. *
  195. * MyType.mixIn({
  196. * field: 'value'
  197. * });
  198. */
  199. mixIn: function (properties) {
  200. for (var propertyName in properties) {
  201. if (properties.hasOwnProperty(propertyName)) {
  202. this[propertyName] = properties[propertyName];
  203. }
  204. }
  205. // IE won't copy toString using the loop above
  206. if (properties.hasOwnProperty('toString')) {
  207. this.toString = properties.toString;
  208. }
  209. },
  210. /**
  211. * Creates a copy of this object.
  212. *
  213. * @return {Object} The clone.
  214. *
  215. * @example
  216. *
  217. * var clone = instance.clone();
  218. */
  219. clone: function () {
  220. return this.init.prototype.extend(this);
  221. }
  222. };
  223. }());
  224. /**
  225. * An array of 32-bit words.
  226. *
  227. * @property {Array} words The array of 32-bit words.
  228. * @property {number} sigBytes The number of significant bytes in this word array.
  229. */
  230. var WordArray = C_lib.WordArray = Base.extend({
  231. /**
  232. * Initializes a newly created word array.
  233. *
  234. * @param {Array} words (Optional) An array of 32-bit words.
  235. * @param {number} sigBytes (Optional) The number of significant bytes in the words.
  236. *
  237. * @example
  238. *
  239. * var wordArray = CryptoJS.lib.WordArray.create();
  240. * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
  241. * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
  242. */
  243. init: function (words, sigBytes) {
  244. words = this.words = words || [];
  245. if (sigBytes != undefined) {
  246. this.sigBytes = sigBytes;
  247. } else {
  248. this.sigBytes = words.length * 4;
  249. }
  250. },
  251. /**
  252. * Converts this word array to a string.
  253. *
  254. * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
  255. *
  256. * @return {string} The stringified word array.
  257. *
  258. * @example
  259. *
  260. * var string = wordArray + '';
  261. * var string = wordArray.toString();
  262. * var string = wordArray.toString(CryptoJS.enc.Utf8);
  263. */
  264. toString: function (encoder) {
  265. return (encoder || Hex).stringify(this);
  266. },
  267. /**
  268. * Concatenates a word array to this word array.
  269. *
  270. * @param {WordArray} wordArray The word array to append.
  271. *
  272. * @return {WordArray} This word array.
  273. *
  274. * @example
  275. *
  276. * wordArray1.concat(wordArray2);
  277. */
  278. concat: function (wordArray) {
  279. // Shortcuts
  280. var thisWords = this.words;
  281. var thatWords = wordArray.words;
  282. var thisSigBytes = this.sigBytes;
  283. var thatSigBytes = wordArray.sigBytes;
  284. // Clamp excess bits
  285. this.clamp();
  286. // Concat
  287. if (thisSigBytes % 4) {
  288. // Copy one byte at a time
  289. for (var i = 0; i < thatSigBytes; i++) {
  290. var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  291. thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
  292. }
  293. } else {
  294. // Copy one word at a time
  295. for (var j = 0; j < thatSigBytes; j += 4) {
  296. thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2];
  297. }
  298. }
  299. this.sigBytes += thatSigBytes;
  300. // Chainable
  301. return this;
  302. },
  303. /**
  304. * Removes insignificant bits.
  305. *
  306. * @example
  307. *
  308. * wordArray.clamp();
  309. */
  310. clamp: function () {
  311. // Shortcuts
  312. var words = this.words;
  313. var sigBytes = this.sigBytes;
  314. // Clamp
  315. words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
  316. words.length = Math.ceil(sigBytes / 4);
  317. },
  318. /**
  319. * Creates a copy of this word array.
  320. *
  321. * @return {WordArray} The clone.
  322. *
  323. * @example
  324. *
  325. * var clone = wordArray.clone();
  326. */
  327. clone: function () {
  328. var clone = Base.clone.call(this);
  329. clone.words = this.words.slice(0);
  330. return clone;
  331. },
  332. /**
  333. * Creates a word array filled with random bytes.
  334. *
  335. * @param {number} nBytes The number of random bytes to generate.
  336. *
  337. * @return {WordArray} The random word array.
  338. *
  339. * @static
  340. *
  341. * @example
  342. *
  343. * var wordArray = CryptoJS.lib.WordArray.random(16);
  344. */
  345. random: function (nBytes) {
  346. var words = [];
  347. for (var i = 0; i < nBytes; i += 4) {
  348. words.push(cryptoSecureRandomInt());
  349. }
  350. return new WordArray.init(words, nBytes);
  351. }
  352. });
  353. /**
  354. * Encoder namespace.
  355. */
  356. var C_enc = C.enc = {};
  357. /**
  358. * Hex encoding strategy.
  359. */
  360. var Hex = C_enc.Hex = {
  361. /**
  362. * Converts a word array to a hex string.
  363. *
  364. * @param {WordArray} wordArray The word array.
  365. *
  366. * @return {string} The hex string.
  367. *
  368. * @static
  369. *
  370. * @example
  371. *
  372. * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
  373. */
  374. stringify: function (wordArray) {
  375. // Shortcuts
  376. var words = wordArray.words;
  377. var sigBytes = wordArray.sigBytes;
  378. // Convert
  379. var hexChars = [];
  380. for (var i = 0; i < sigBytes; i++) {
  381. var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  382. hexChars.push((bite >>> 4).toString(16));
  383. hexChars.push((bite & 0x0f).toString(16));
  384. }
  385. return hexChars.join('');
  386. },
  387. /**
  388. * Converts a hex string to a word array.
  389. *
  390. * @param {string} hexStr The hex string.
  391. *
  392. * @return {WordArray} The word array.
  393. *
  394. * @static
  395. *
  396. * @example
  397. *
  398. * var wordArray = CryptoJS.enc.Hex.parse(hexString);
  399. */
  400. parse: function (hexStr) {
  401. // Shortcut
  402. var hexStrLength = hexStr.length;
  403. // Convert
  404. var words = [];
  405. for (var i = 0; i < hexStrLength; i += 2) {
  406. words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
  407. }
  408. return new WordArray.init(words, hexStrLength / 2);
  409. }
  410. };
  411. /**
  412. * Latin1 encoding strategy.
  413. */
  414. var Latin1 = C_enc.Latin1 = {
  415. /**
  416. * Converts a word array to a Latin1 string.
  417. *
  418. * @param {WordArray} wordArray The word array.
  419. *
  420. * @return {string} The Latin1 string.
  421. *
  422. * @static
  423. *
  424. * @example
  425. *
  426. * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
  427. */
  428. stringify: function (wordArray) {
  429. // Shortcuts
  430. var words = wordArray.words;
  431. var sigBytes = wordArray.sigBytes;
  432. // Convert
  433. var latin1Chars = [];
  434. for (var i = 0; i < sigBytes; i++) {
  435. var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  436. latin1Chars.push(String.fromCharCode(bite));
  437. }
  438. return latin1Chars.join('');
  439. },
  440. /**
  441. * Converts a Latin1 string to a word array.
  442. *
  443. * @param {string} latin1Str The Latin1 string.
  444. *
  445. * @return {WordArray} The word array.
  446. *
  447. * @static
  448. *
  449. * @example
  450. *
  451. * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
  452. */
  453. parse: function (latin1Str) {
  454. // Shortcut
  455. var latin1StrLength = latin1Str.length;
  456. // Convert
  457. var words = [];
  458. for (var i = 0; i < latin1StrLength; i++) {
  459. words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
  460. }
  461. return new WordArray.init(words, latin1StrLength);
  462. }
  463. };
  464. /**
  465. * UTF-8 encoding strategy.
  466. */
  467. var Utf8 = C_enc.Utf8 = {
  468. /**
  469. * Converts a word array to a UTF-8 string.
  470. *
  471. * @param {WordArray} wordArray The word array.
  472. *
  473. * @return {string} The UTF-8 string.
  474. *
  475. * @static
  476. *
  477. * @example
  478. *
  479. * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
  480. */
  481. stringify: function (wordArray) {
  482. try {
  483. return decodeURIComponent(escape(Latin1.stringify(wordArray)));
  484. } catch (e) {
  485. throw new Error('Malformed UTF-8 data');
  486. }
  487. },
  488. /**
  489. * Converts a UTF-8 string to a word array.
  490. *
  491. * @param {string} utf8Str The UTF-8 string.
  492. *
  493. * @return {WordArray} The word array.
  494. *
  495. * @static
  496. *
  497. * @example
  498. *
  499. * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
  500. */
  501. parse: function (utf8Str) {
  502. return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
  503. }
  504. };
  505. /**
  506. * Abstract buffered block algorithm template.
  507. *
  508. * The property blockSize must be implemented in a concrete subtype.
  509. *
  510. * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
  511. */
  512. var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
  513. /**
  514. * Resets this block algorithm's data buffer to its initial state.
  515. *
  516. * @example
  517. *
  518. * bufferedBlockAlgorithm.reset();
  519. */
  520. reset: function () {
  521. // Initial values
  522. this._data = new WordArray.init();
  523. this._nDataBytes = 0;
  524. },
  525. /**
  526. * Adds new data to this block algorithm's buffer.
  527. *
  528. * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
  529. *
  530. * @example
  531. *
  532. * bufferedBlockAlgorithm._append('data');
  533. * bufferedBlockAlgorithm._append(wordArray);
  534. */
  535. _append: function (data) {
  536. // Convert string to WordArray, else assume WordArray already
  537. if (typeof data == 'string') {
  538. data = Utf8.parse(data);
  539. }
  540. // Append
  541. this._data.concat(data);
  542. this._nDataBytes += data.sigBytes;
  543. },
  544. /**
  545. * Processes available data blocks.
  546. *
  547. * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
  548. *
  549. * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
  550. *
  551. * @return {WordArray} The processed data.
  552. *
  553. * @example
  554. *
  555. * var processedData = bufferedBlockAlgorithm._process();
  556. * var processedData = bufferedBlockAlgorithm._process(!!'flush');
  557. */
  558. _process: function (doFlush) {
  559. var processedWords;
  560. // Shortcuts
  561. var data = this._data;
  562. var dataWords = data.words;
  563. var dataSigBytes = data.sigBytes;
  564. var blockSize = this.blockSize;
  565. var blockSizeBytes = blockSize * 4;
  566. // Count blocks ready
  567. var nBlocksReady = dataSigBytes / blockSizeBytes;
  568. if (doFlush) {
  569. // Round up to include partial blocks
  570. nBlocksReady = Math.ceil(nBlocksReady);
  571. } else {
  572. // Round down to include only full blocks,
  573. // less the number of blocks that must remain in the buffer
  574. nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
  575. }
  576. // Count words ready
  577. var nWordsReady = nBlocksReady * blockSize;
  578. // Count bytes ready
  579. var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
  580. // Process blocks
  581. if (nWordsReady) {
  582. for (var offset = 0; offset < nWordsReady; offset += blockSize) {
  583. // Perform concrete-algorithm logic
  584. this._doProcessBlock(dataWords, offset);
  585. }
  586. // Remove processed words
  587. processedWords = dataWords.splice(0, nWordsReady);
  588. data.sigBytes -= nBytesReady;
  589. }
  590. // Return processed words
  591. return new WordArray.init(processedWords, nBytesReady);
  592. },
  593. /**
  594. * Creates a copy of this object.
  595. *
  596. * @return {Object} The clone.
  597. *
  598. * @example
  599. *
  600. * var clone = bufferedBlockAlgorithm.clone();
  601. */
  602. clone: function () {
  603. var clone = Base.clone.call(this);
  604. clone._data = this._data.clone();
  605. return clone;
  606. },
  607. _minBufferSize: 0
  608. });
  609. /**
  610. * Abstract hasher template.
  611. *
  612. * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
  613. */
  614. var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
  615. /**
  616. * Configuration options.
  617. */
  618. cfg: Base.extend(),
  619. /**
  620. * Initializes a newly created hasher.
  621. *
  622. * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
  623. *
  624. * @example
  625. *
  626. * var hasher = CryptoJS.algo.SHA256.create();
  627. */
  628. init: function (cfg) {
  629. // Apply config defaults
  630. this.cfg = this.cfg.extend(cfg);
  631. // Set initial values
  632. this.reset();
  633. },
  634. /**
  635. * Resets this hasher to its initial state.
  636. *
  637. * @example
  638. *
  639. * hasher.reset();
  640. */
  641. reset: function () {
  642. // Reset data buffer
  643. BufferedBlockAlgorithm.reset.call(this);
  644. // Perform concrete-hasher logic
  645. this._doReset();
  646. },
  647. /**
  648. * Updates this hasher with a message.
  649. *
  650. * @param {WordArray|string} messageUpdate The message to append.
  651. *
  652. * @return {Hasher} This hasher.
  653. *
  654. * @example
  655. *
  656. * hasher.update('message');
  657. * hasher.update(wordArray);
  658. */
  659. update: function (messageUpdate) {
  660. // Append
  661. this._append(messageUpdate);
  662. // Update the hash
  663. this._process();
  664. // Chainable
  665. return this;
  666. },
  667. /**
  668. * Finalizes the hash computation.
  669. * Note that the finalize operation is effectively a destructive, read-once operation.
  670. *
  671. * @param {WordArray|string} messageUpdate (Optional) A final message update.
  672. *
  673. * @return {WordArray} The hash.
  674. *
  675. * @example
  676. *
  677. * var hash = hasher.finalize();
  678. * var hash = hasher.finalize('message');
  679. * var hash = hasher.finalize(wordArray);
  680. */
  681. finalize: function (messageUpdate) {
  682. // Final message update
  683. if (messageUpdate) {
  684. this._append(messageUpdate);
  685. }
  686. // Perform concrete-hasher logic
  687. var hash = this._doFinalize();
  688. return hash;
  689. },
  690. blockSize: 512/32,
  691. /**
  692. * Creates a shortcut function to a hasher's object interface.
  693. *
  694. * @param {Hasher} hasher The hasher to create a helper for.
  695. *
  696. * @return {Function} The shortcut function.
  697. *
  698. * @static
  699. *
  700. * @example
  701. *
  702. * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
  703. */
  704. _createHelper: function (hasher) {
  705. return function (message, cfg) {
  706. return new hasher.init(cfg).finalize(message);
  707. };
  708. },
  709. /**
  710. * Creates a shortcut function to the HMAC's object interface.
  711. *
  712. * @param {Hasher} hasher The hasher to use in this HMAC helper.
  713. *
  714. * @return {Function} The shortcut function.
  715. *
  716. * @static
  717. *
  718. * @example
  719. *
  720. * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
  721. */
  722. _createHmacHelper: function (hasher) {
  723. return function (message, key) {
  724. return new C_algo.HMAC.init(hasher, key).finalize(message);
  725. };
  726. }
  727. });
  728. /**
  729. * Algorithm namespace.
  730. */
  731. var C_algo = C.algo = {};
  732. return C;
  733. }(Math));
  734. return CryptoJS;
  735. }));
  736. }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
  737. __DEFINE__(1733984946568, function(require, module, exports) {
  738. ;(function (root, factory) {
  739. if (typeof exports === "object") {
  740. // CommonJS
  741. module.exports = exports = factory(require("./core"));
  742. }
  743. else if (typeof define === "function" && define.amd) {
  744. // AMD
  745. define(["./core"], factory);
  746. }
  747. else {
  748. // Global (browser)
  749. factory(root.CryptoJS);
  750. }
  751. }(this, function (CryptoJS) {
  752. (function (undefined) {
  753. // Shortcuts
  754. var C = CryptoJS;
  755. var C_lib = C.lib;
  756. var Base = C_lib.Base;
  757. var X32WordArray = C_lib.WordArray;
  758. /**
  759. * x64 namespace.
  760. */
  761. var C_x64 = C.x64 = {};
  762. /**
  763. * A 64-bit word.
  764. */
  765. var X64Word = C_x64.Word = Base.extend({
  766. /**
  767. * Initializes a newly created 64-bit word.
  768. *
  769. * @param {number} high The high 32 bits.
  770. * @param {number} low The low 32 bits.
  771. *
  772. * @example
  773. *
  774. * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);
  775. */
  776. init: function (high, low) {
  777. this.high = high;
  778. this.low = low;
  779. }
  780. /**
  781. * Bitwise NOTs this word.
  782. *
  783. * @return {X64Word} A new x64-Word object after negating.
  784. *
  785. * @example
  786. *
  787. * var negated = x64Word.not();
  788. */
  789. // not: function () {
  790. // var high = ~this.high;
  791. // var low = ~this.low;
  792. // return X64Word.create(high, low);
  793. // },
  794. /**
  795. * Bitwise ANDs this word with the passed word.
  796. *
  797. * @param {X64Word} word The x64-Word to AND with this word.
  798. *
  799. * @return {X64Word} A new x64-Word object after ANDing.
  800. *
  801. * @example
  802. *
  803. * var anded = x64Word.and(anotherX64Word);
  804. */
  805. // and: function (word) {
  806. // var high = this.high & word.high;
  807. // var low = this.low & word.low;
  808. // return X64Word.create(high, low);
  809. // },
  810. /**
  811. * Bitwise ORs this word with the passed word.
  812. *
  813. * @param {X64Word} word The x64-Word to OR with this word.
  814. *
  815. * @return {X64Word} A new x64-Word object after ORing.
  816. *
  817. * @example
  818. *
  819. * var ored = x64Word.or(anotherX64Word);
  820. */
  821. // or: function (word) {
  822. // var high = this.high | word.high;
  823. // var low = this.low | word.low;
  824. // return X64Word.create(high, low);
  825. // },
  826. /**
  827. * Bitwise XORs this word with the passed word.
  828. *
  829. * @param {X64Word} word The x64-Word to XOR with this word.
  830. *
  831. * @return {X64Word} A new x64-Word object after XORing.
  832. *
  833. * @example
  834. *
  835. * var xored = x64Word.xor(anotherX64Word);
  836. */
  837. // xor: function (word) {
  838. // var high = this.high ^ word.high;
  839. // var low = this.low ^ word.low;
  840. // return X64Word.create(high, low);
  841. // },
  842. /**
  843. * Shifts this word n bits to the left.
  844. *
  845. * @param {number} n The number of bits to shift.
  846. *
  847. * @return {X64Word} A new x64-Word object after shifting.
  848. *
  849. * @example
  850. *
  851. * var shifted = x64Word.shiftL(25);
  852. */
  853. // shiftL: function (n) {
  854. // if (n < 32) {
  855. // var high = (this.high << n) | (this.low >>> (32 - n));
  856. // var low = this.low << n;
  857. // } else {
  858. // var high = this.low << (n - 32);
  859. // var low = 0;
  860. // }
  861. // return X64Word.create(high, low);
  862. // },
  863. /**
  864. * Shifts this word n bits to the right.
  865. *
  866. * @param {number} n The number of bits to shift.
  867. *
  868. * @return {X64Word} A new x64-Word object after shifting.
  869. *
  870. * @example
  871. *
  872. * var shifted = x64Word.shiftR(7);
  873. */
  874. // shiftR: function (n) {
  875. // if (n < 32) {
  876. // var low = (this.low >>> n) | (this.high << (32 - n));
  877. // var high = this.high >>> n;
  878. // } else {
  879. // var low = this.high >>> (n - 32);
  880. // var high = 0;
  881. // }
  882. // return X64Word.create(high, low);
  883. // },
  884. /**
  885. * Rotates this word n bits to the left.
  886. *
  887. * @param {number} n The number of bits to rotate.
  888. *
  889. * @return {X64Word} A new x64-Word object after rotating.
  890. *
  891. * @example
  892. *
  893. * var rotated = x64Word.rotL(25);
  894. */
  895. // rotL: function (n) {
  896. // return this.shiftL(n).or(this.shiftR(64 - n));
  897. // },
  898. /**
  899. * Rotates this word n bits to the right.
  900. *
  901. * @param {number} n The number of bits to rotate.
  902. *
  903. * @return {X64Word} A new x64-Word object after rotating.
  904. *
  905. * @example
  906. *
  907. * var rotated = x64Word.rotR(7);
  908. */
  909. // rotR: function (n) {
  910. // return this.shiftR(n).or(this.shiftL(64 - n));
  911. // },
  912. /**
  913. * Adds this word with the passed word.
  914. *
  915. * @param {X64Word} word The x64-Word to add with this word.
  916. *
  917. * @return {X64Word} A new x64-Word object after adding.
  918. *
  919. * @example
  920. *
  921. * var added = x64Word.add(anotherX64Word);
  922. */
  923. // add: function (word) {
  924. // var low = (this.low + word.low) | 0;
  925. // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
  926. // var high = (this.high + word.high + carry) | 0;
  927. // return X64Word.create(high, low);
  928. // }
  929. });
  930. /**
  931. * An array of 64-bit words.
  932. *
  933. * @property {Array} words The array of CryptoJS.x64.Word objects.
  934. * @property {number} sigBytes The number of significant bytes in this word array.
  935. */
  936. var X64WordArray = C_x64.WordArray = Base.extend({
  937. /**
  938. * Initializes a newly created word array.
  939. *
  940. * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
  941. * @param {number} sigBytes (Optional) The number of significant bytes in the words.
  942. *
  943. * @example
  944. *
  945. * var wordArray = CryptoJS.x64.WordArray.create();
  946. *
  947. * var wordArray = CryptoJS.x64.WordArray.create([
  948. * CryptoJS.x64.Word.create(0x00010203, 0x04050607),
  949. * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
  950. * ]);
  951. *
  952. * var wordArray = CryptoJS.x64.WordArray.create([
  953. * CryptoJS.x64.Word.create(0x00010203, 0x04050607),
  954. * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
  955. * ], 10);
  956. */
  957. init: function (words, sigBytes) {
  958. words = this.words = words || [];
  959. if (sigBytes != undefined) {
  960. this.sigBytes = sigBytes;
  961. } else {
  962. this.sigBytes = words.length * 8;
  963. }
  964. },
  965. /**
  966. * Converts this 64-bit word array to a 32-bit word array.
  967. *
  968. * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
  969. *
  970. * @example
  971. *
  972. * var x32WordArray = x64WordArray.toX32();
  973. */
  974. toX32: function () {
  975. // Shortcuts
  976. var x64Words = this.words;
  977. var x64WordsLength = x64Words.length;
  978. // Convert
  979. var x32Words = [];
  980. for (var i = 0; i < x64WordsLength; i++) {
  981. var x64Word = x64Words[i];
  982. x32Words.push(x64Word.high);
  983. x32Words.push(x64Word.low);
  984. }
  985. return X32WordArray.create(x32Words, this.sigBytes);
  986. },
  987. /**
  988. * Creates a copy of this word array.
  989. *
  990. * @return {X64WordArray} The clone.
  991. *
  992. * @example
  993. *
  994. * var clone = x64WordArray.clone();
  995. */
  996. clone: function () {
  997. var clone = Base.clone.call(this);
  998. // Clone "words" array
  999. var words = clone.words = this.words.slice(0);
  1000. // Clone each X64Word object
  1001. var wordsLength = words.length;
  1002. for (var i = 0; i < wordsLength; i++) {
  1003. words[i] = words[i].clone();
  1004. }
  1005. return clone;
  1006. }
  1007. });
  1008. }());
  1009. return CryptoJS;
  1010. }));
  1011. }, function(modId) { var map = {"./core":1733984946567}; return __REQUIRE__(map[modId], modId); })
  1012. __DEFINE__(1733984946569, function(require, module, exports) {
  1013. ;(function (root, factory) {
  1014. if (typeof exports === "object") {
  1015. // CommonJS
  1016. module.exports = exports = factory(require("./core"));
  1017. }
  1018. else if (typeof define === "function" && define.amd) {
  1019. // AMD
  1020. define(["./core"], factory);
  1021. }
  1022. else {
  1023. // Global (browser)
  1024. factory(root.CryptoJS);
  1025. }
  1026. }(this, function (CryptoJS) {
  1027. (function () {
  1028. // Check if typed arrays are supported
  1029. if (typeof ArrayBuffer != 'function') {
  1030. return;
  1031. }
  1032. // Shortcuts
  1033. var C = CryptoJS;
  1034. var C_lib = C.lib;
  1035. var WordArray = C_lib.WordArray;
  1036. // Reference original init
  1037. var superInit = WordArray.init;
  1038. // Augment WordArray.init to handle typed arrays
  1039. var subInit = WordArray.init = function (typedArray) {
  1040. // Convert buffers to uint8
  1041. if (typedArray instanceof ArrayBuffer) {
  1042. typedArray = new Uint8Array(typedArray);
  1043. }
  1044. // Convert other array views to uint8
  1045. if (
  1046. typedArray instanceof Int8Array ||
  1047. (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) ||
  1048. typedArray instanceof Int16Array ||
  1049. typedArray instanceof Uint16Array ||
  1050. typedArray instanceof Int32Array ||
  1051. typedArray instanceof Uint32Array ||
  1052. typedArray instanceof Float32Array ||
  1053. typedArray instanceof Float64Array
  1054. ) {
  1055. typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
  1056. }
  1057. // Handle Uint8Array
  1058. if (typedArray instanceof Uint8Array) {
  1059. // Shortcut
  1060. var typedArrayByteLength = typedArray.byteLength;
  1061. // Extract bytes
  1062. var words = [];
  1063. for (var i = 0; i < typedArrayByteLength; i++) {
  1064. words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);
  1065. }
  1066. // Initialize this word array
  1067. superInit.call(this, words, typedArrayByteLength);
  1068. } else {
  1069. // Else call normal init
  1070. superInit.apply(this, arguments);
  1071. }
  1072. };
  1073. subInit.prototype = WordArray;
  1074. }());
  1075. return CryptoJS.lib.WordArray;
  1076. }));
  1077. }, function(modId) { var map = {"./core":1733984946567}; return __REQUIRE__(map[modId], modId); })
  1078. __DEFINE__(1733984946570, function(require, module, exports) {
  1079. ;(function (root, factory) {
  1080. if (typeof exports === "object") {
  1081. // CommonJS
  1082. module.exports = exports = factory(require("./core"));
  1083. }
  1084. else if (typeof define === "function" && define.amd) {
  1085. // AMD
  1086. define(["./core"], factory);
  1087. }
  1088. else {
  1089. // Global (browser)
  1090. factory(root.CryptoJS);
  1091. }
  1092. }(this, function (CryptoJS) {
  1093. (function () {
  1094. // Shortcuts
  1095. var C = CryptoJS;
  1096. var C_lib = C.lib;
  1097. var WordArray = C_lib.WordArray;
  1098. var C_enc = C.enc;
  1099. /**
  1100. * UTF-16 BE encoding strategy.
  1101. */
  1102. var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = {
  1103. /**
  1104. * Converts a word array to a UTF-16 BE string.
  1105. *
  1106. * @param {WordArray} wordArray The word array.
  1107. *
  1108. * @return {string} The UTF-16 BE string.
  1109. *
  1110. * @static
  1111. *
  1112. * @example
  1113. *
  1114. * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);
  1115. */
  1116. stringify: function (wordArray) {
  1117. // Shortcuts
  1118. var words = wordArray.words;
  1119. var sigBytes = wordArray.sigBytes;
  1120. // Convert
  1121. var utf16Chars = [];
  1122. for (var i = 0; i < sigBytes; i += 2) {
  1123. var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff;
  1124. utf16Chars.push(String.fromCharCode(codePoint));
  1125. }
  1126. return utf16Chars.join('');
  1127. },
  1128. /**
  1129. * Converts a UTF-16 BE string to a word array.
  1130. *
  1131. * @param {string} utf16Str The UTF-16 BE string.
  1132. *
  1133. * @return {WordArray} The word array.
  1134. *
  1135. * @static
  1136. *
  1137. * @example
  1138. *
  1139. * var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
  1140. */
  1141. parse: function (utf16Str) {
  1142. // Shortcut
  1143. var utf16StrLength = utf16Str.length;
  1144. // Convert
  1145. var words = [];
  1146. for (var i = 0; i < utf16StrLength; i++) {
  1147. words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16);
  1148. }
  1149. return WordArray.create(words, utf16StrLength * 2);
  1150. }
  1151. };
  1152. /**
  1153. * UTF-16 LE encoding strategy.
  1154. */
  1155. C_enc.Utf16LE = {
  1156. /**
  1157. * Converts a word array to a UTF-16 LE string.
  1158. *
  1159. * @param {WordArray} wordArray The word array.
  1160. *
  1161. * @return {string} The UTF-16 LE string.
  1162. *
  1163. * @static
  1164. *
  1165. * @example
  1166. *
  1167. * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);
  1168. */
  1169. stringify: function (wordArray) {
  1170. // Shortcuts
  1171. var words = wordArray.words;
  1172. var sigBytes = wordArray.sigBytes;
  1173. // Convert
  1174. var utf16Chars = [];
  1175. for (var i = 0; i < sigBytes; i += 2) {
  1176. var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff);
  1177. utf16Chars.push(String.fromCharCode(codePoint));
  1178. }
  1179. return utf16Chars.join('');
  1180. },
  1181. /**
  1182. * Converts a UTF-16 LE string to a word array.
  1183. *
  1184. * @param {string} utf16Str The UTF-16 LE string.
  1185. *
  1186. * @return {WordArray} The word array.
  1187. *
  1188. * @static
  1189. *
  1190. * @example
  1191. *
  1192. * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);
  1193. */
  1194. parse: function (utf16Str) {
  1195. // Shortcut
  1196. var utf16StrLength = utf16Str.length;
  1197. // Convert
  1198. var words = [];
  1199. for (var i = 0; i < utf16StrLength; i++) {
  1200. words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16));
  1201. }
  1202. return WordArray.create(words, utf16StrLength * 2);
  1203. }
  1204. };
  1205. function swapEndian(word) {
  1206. return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff);
  1207. }
  1208. }());
  1209. return CryptoJS.enc.Utf16;
  1210. }));
  1211. }, function(modId) { var map = {"./core":1733984946567}; return __REQUIRE__(map[modId], modId); })
  1212. __DEFINE__(1733984946571, function(require, module, exports) {
  1213. ;(function (root, factory) {
  1214. if (typeof exports === "object") {
  1215. // CommonJS
  1216. module.exports = exports = factory(require("./core"));
  1217. }
  1218. else if (typeof define === "function" && define.amd) {
  1219. // AMD
  1220. define(["./core"], factory);
  1221. }
  1222. else {
  1223. // Global (browser)
  1224. factory(root.CryptoJS);
  1225. }
  1226. }(this, function (CryptoJS) {
  1227. (function () {
  1228. // Shortcuts
  1229. var C = CryptoJS;
  1230. var C_lib = C.lib;
  1231. var WordArray = C_lib.WordArray;
  1232. var C_enc = C.enc;
  1233. /**
  1234. * Base64 encoding strategy.
  1235. */
  1236. var Base64 = C_enc.Base64 = {
  1237. /**
  1238. * Converts a word array to a Base64 string.
  1239. *
  1240. * @param {WordArray} wordArray The word array.
  1241. *
  1242. * @return {string} The Base64 string.
  1243. *
  1244. * @static
  1245. *
  1246. * @example
  1247. *
  1248. * var base64String = CryptoJS.enc.Base64.stringify(wordArray);
  1249. */
  1250. stringify: function (wordArray) {
  1251. // Shortcuts
  1252. var words = wordArray.words;
  1253. var sigBytes = wordArray.sigBytes;
  1254. var map = this._map;
  1255. // Clamp excess bits
  1256. wordArray.clamp();
  1257. // Convert
  1258. var base64Chars = [];
  1259. for (var i = 0; i < sigBytes; i += 3) {
  1260. var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  1261. var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
  1262. var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
  1263. var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
  1264. for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
  1265. base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
  1266. }
  1267. }
  1268. // Add padding
  1269. var paddingChar = map.charAt(64);
  1270. if (paddingChar) {
  1271. while (base64Chars.length % 4) {
  1272. base64Chars.push(paddingChar);
  1273. }
  1274. }
  1275. return base64Chars.join('');
  1276. },
  1277. /**
  1278. * Converts a Base64 string to a word array.
  1279. *
  1280. * @param {string} base64Str The Base64 string.
  1281. *
  1282. * @return {WordArray} The word array.
  1283. *
  1284. * @static
  1285. *
  1286. * @example
  1287. *
  1288. * var wordArray = CryptoJS.enc.Base64.parse(base64String);
  1289. */
  1290. parse: function (base64Str) {
  1291. // Shortcuts
  1292. var base64StrLength = base64Str.length;
  1293. var map = this._map;
  1294. var reverseMap = this._reverseMap;
  1295. if (!reverseMap) {
  1296. reverseMap = this._reverseMap = [];
  1297. for (var j = 0; j < map.length; j++) {
  1298. reverseMap[map.charCodeAt(j)] = j;
  1299. }
  1300. }
  1301. // Ignore padding
  1302. var paddingChar = map.charAt(64);
  1303. if (paddingChar) {
  1304. var paddingIndex = base64Str.indexOf(paddingChar);
  1305. if (paddingIndex !== -1) {
  1306. base64StrLength = paddingIndex;
  1307. }
  1308. }
  1309. // Convert
  1310. return parseLoop(base64Str, base64StrLength, reverseMap);
  1311. },
  1312. _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
  1313. };
  1314. function parseLoop(base64Str, base64StrLength, reverseMap) {
  1315. var words = [];
  1316. var nBytes = 0;
  1317. for (var i = 0; i < base64StrLength; i++) {
  1318. if (i % 4) {
  1319. var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
  1320. var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
  1321. var bitsCombined = bits1 | bits2;
  1322. words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);
  1323. nBytes++;
  1324. }
  1325. }
  1326. return WordArray.create(words, nBytes);
  1327. }
  1328. }());
  1329. return CryptoJS.enc.Base64;
  1330. }));
  1331. }, function(modId) { var map = {"./core":1733984946567}; return __REQUIRE__(map[modId], modId); })
  1332. __DEFINE__(1733984946572, function(require, module, exports) {
  1333. ;(function (root, factory) {
  1334. if (typeof exports === "object") {
  1335. // CommonJS
  1336. module.exports = exports = factory(require("./core"));
  1337. }
  1338. else if (typeof define === "function" && define.amd) {
  1339. // AMD
  1340. define(["./core"], factory);
  1341. }
  1342. else {
  1343. // Global (browser)
  1344. factory(root.CryptoJS);
  1345. }
  1346. }(this, function (CryptoJS) {
  1347. (function () {
  1348. // Shortcuts
  1349. var C = CryptoJS;
  1350. var C_lib = C.lib;
  1351. var WordArray = C_lib.WordArray;
  1352. var C_enc = C.enc;
  1353. /**
  1354. * Base64url encoding strategy.
  1355. */
  1356. var Base64url = C_enc.Base64url = {
  1357. /**
  1358. * Converts a word array to a Base64url string.
  1359. *
  1360. * @param {WordArray} wordArray The word array.
  1361. *
  1362. * @param {boolean} urlSafe Whether to use url safe
  1363. *
  1364. * @return {string} The Base64url string.
  1365. *
  1366. * @static
  1367. *
  1368. * @example
  1369. *
  1370. * var base64String = CryptoJS.enc.Base64url.stringify(wordArray);
  1371. */
  1372. stringify: function (wordArray, urlSafe) {
  1373. if (urlSafe === undefined) {
  1374. urlSafe = true
  1375. }
  1376. // Shortcuts
  1377. var words = wordArray.words;
  1378. var sigBytes = wordArray.sigBytes;
  1379. var map = urlSafe ? this._safe_map : this._map;
  1380. // Clamp excess bits
  1381. wordArray.clamp();
  1382. // Convert
  1383. var base64Chars = [];
  1384. for (var i = 0; i < sigBytes; i += 3) {
  1385. var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
  1386. var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
  1387. var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
  1388. var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
  1389. for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
  1390. base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
  1391. }
  1392. }
  1393. // Add padding
  1394. var paddingChar = map.charAt(64);
  1395. if (paddingChar) {
  1396. while (base64Chars.length % 4) {
  1397. base64Chars.push(paddingChar);
  1398. }
  1399. }
  1400. return base64Chars.join('');
  1401. },
  1402. /**
  1403. * Converts a Base64url string to a word array.
  1404. *
  1405. * @param {string} base64Str The Base64url string.
  1406. *
  1407. * @param {boolean} urlSafe Whether to use url safe
  1408. *
  1409. * @return {WordArray} The word array.
  1410. *
  1411. * @static
  1412. *
  1413. * @example
  1414. *
  1415. * var wordArray = CryptoJS.enc.Base64url.parse(base64String);
  1416. */
  1417. parse: function (base64Str, urlSafe) {
  1418. if (urlSafe === undefined) {
  1419. urlSafe = true
  1420. }
  1421. // Shortcuts
  1422. var base64StrLength = base64Str.length;
  1423. var map = urlSafe ? this._safe_map : this._map;
  1424. var reverseMap = this._reverseMap;
  1425. if (!reverseMap) {
  1426. reverseMap = this._reverseMap = [];
  1427. for (var j = 0; j < map.length; j++) {
  1428. reverseMap[map.charCodeAt(j)] = j;
  1429. }
  1430. }
  1431. // Ignore padding
  1432. var paddingChar = map.charAt(64);
  1433. if (paddingChar) {
  1434. var paddingIndex = base64Str.indexOf(paddingChar);
  1435. if (paddingIndex !== -1) {
  1436. base64StrLength = paddingIndex;
  1437. }
  1438. }
  1439. // Convert
  1440. return parseLoop(base64Str, base64StrLength, reverseMap);
  1441. },
  1442. _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
  1443. _safe_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',
  1444. };
  1445. function parseLoop(base64Str, base64StrLength, reverseMap) {
  1446. var words = [];
  1447. var nBytes = 0;
  1448. for (var i = 0; i < base64StrLength; i++) {
  1449. if (i % 4) {
  1450. var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
  1451. var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
  1452. var bitsCombined = bits1 | bits2;
  1453. words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);
  1454. nBytes++;
  1455. }
  1456. }
  1457. return WordArray.create(words, nBytes);
  1458. }
  1459. }());
  1460. return CryptoJS.enc.Base64url;
  1461. }));
  1462. }, function(modId) { var map = {"./core":1733984946567}; return __REQUIRE__(map[modId], modId); })
  1463. __DEFINE__(1733984946573, function(require, module, exports) {
  1464. ;(function (root, factory) {
  1465. if (typeof exports === "object") {
  1466. // CommonJS
  1467. module.exports = exports = factory(require("./core"));
  1468. }
  1469. else if (typeof define === "function" && define.amd) {
  1470. // AMD
  1471. define(["./core"], factory);
  1472. }
  1473. else {
  1474. // Global (browser)
  1475. factory(root.CryptoJS);
  1476. }
  1477. }(this, function (CryptoJS) {
  1478. (function (Math) {
  1479. // Shortcuts
  1480. var C = CryptoJS;
  1481. var C_lib = C.lib;
  1482. var WordArray = C_lib.WordArray;
  1483. var Hasher = C_lib.Hasher;
  1484. var C_algo = C.algo;
  1485. // Constants table
  1486. var T = [];
  1487. // Compute constants
  1488. (function () {
  1489. for (var i = 0; i < 64; i++) {
  1490. T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
  1491. }
  1492. }());
  1493. /**
  1494. * MD5 hash algorithm.
  1495. */
  1496. var MD5 = C_algo.MD5 = Hasher.extend({
  1497. _doReset: function () {
  1498. this._hash = new WordArray.init([
  1499. 0x67452301, 0xefcdab89,
  1500. 0x98badcfe, 0x10325476
  1501. ]);
  1502. },
  1503. _doProcessBlock: function (M, offset) {
  1504. // Swap endian
  1505. for (var i = 0; i < 16; i++) {
  1506. // Shortcuts
  1507. var offset_i = offset + i;
  1508. var M_offset_i = M[offset_i];
  1509. M[offset_i] = (
  1510. (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
  1511. (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
  1512. );
  1513. }
  1514. // Shortcuts
  1515. var H = this._hash.words;
  1516. var M_offset_0 = M[offset + 0];
  1517. var M_offset_1 = M[offset + 1];
  1518. var M_offset_2 = M[offset + 2];
  1519. var M_offset_3 = M[offset + 3];
  1520. var M_offset_4 = M[offset + 4];
  1521. var M_offset_5 = M[offset + 5];
  1522. var M_offset_6 = M[offset + 6];
  1523. var M_offset_7 = M[offset + 7];
  1524. var M_offset_8 = M[offset + 8];
  1525. var M_offset_9 = M[offset + 9];
  1526. var M_offset_10 = M[offset + 10];
  1527. var M_offset_11 = M[offset + 11];
  1528. var M_offset_12 = M[offset + 12];
  1529. var M_offset_13 = M[offset + 13];
  1530. var M_offset_14 = M[offset + 14];
  1531. var M_offset_15 = M[offset + 15];
  1532. // Working variables
  1533. var a = H[0];
  1534. var b = H[1];
  1535. var c = H[2];
  1536. var d = H[3];
  1537. // Computation
  1538. a = FF(a, b, c, d, M_offset_0, 7, T[0]);
  1539. d = FF(d, a, b, c, M_offset_1, 12, T[1]);
  1540. c = FF(c, d, a, b, M_offset_2, 17, T[2]);
  1541. b = FF(b, c, d, a, M_offset_3, 22, T[3]);
  1542. a = FF(a, b, c, d, M_offset_4, 7, T[4]);
  1543. d = FF(d, a, b, c, M_offset_5, 12, T[5]);
  1544. c = FF(c, d, a, b, M_offset_6, 17, T[6]);
  1545. b = FF(b, c, d, a, M_offset_7, 22, T[7]);
  1546. a = FF(a, b, c, d, M_offset_8, 7, T[8]);
  1547. d = FF(d, a, b, c, M_offset_9, 12, T[9]);
  1548. c = FF(c, d, a, b, M_offset_10, 17, T[10]);
  1549. b = FF(b, c, d, a, M_offset_11, 22, T[11]);
  1550. a = FF(a, b, c, d, M_offset_12, 7, T[12]);
  1551. d = FF(d, a, b, c, M_offset_13, 12, T[13]);
  1552. c = FF(c, d, a, b, M_offset_14, 17, T[14]);
  1553. b = FF(b, c, d, a, M_offset_15, 22, T[15]);
  1554. a = GG(a, b, c, d, M_offset_1, 5, T[16]);
  1555. d = GG(d, a, b, c, M_offset_6, 9, T[17]);
  1556. c = GG(c, d, a, b, M_offset_11, 14, T[18]);
  1557. b = GG(b, c, d, a, M_offset_0, 20, T[19]);
  1558. a = GG(a, b, c, d, M_offset_5, 5, T[20]);
  1559. d = GG(d, a, b, c, M_offset_10, 9, T[21]);
  1560. c = GG(c, d, a, b, M_offset_15, 14, T[22]);
  1561. b = GG(b, c, d, a, M_offset_4, 20, T[23]);
  1562. a = GG(a, b, c, d, M_offset_9, 5, T[24]);
  1563. d = GG(d, a, b, c, M_offset_14, 9, T[25]);
  1564. c = GG(c, d, a, b, M_offset_3, 14, T[26]);
  1565. b = GG(b, c, d, a, M_offset_8, 20, T[27]);
  1566. a = GG(a, b, c, d, M_offset_13, 5, T[28]);
  1567. d = GG(d, a, b, c, M_offset_2, 9, T[29]);
  1568. c = GG(c, d, a, b, M_offset_7, 14, T[30]);
  1569. b = GG(b, c, d, a, M_offset_12, 20, T[31]);
  1570. a = HH(a, b, c, d, M_offset_5, 4, T[32]);
  1571. d = HH(d, a, b, c, M_offset_8, 11, T[33]);
  1572. c = HH(c, d, a, b, M_offset_11, 16, T[34]);
  1573. b = HH(b, c, d, a, M_offset_14, 23, T[35]);
  1574. a = HH(a, b, c, d, M_offset_1, 4, T[36]);
  1575. d = HH(d, a, b, c, M_offset_4, 11, T[37]);
  1576. c = HH(c, d, a, b, M_offset_7, 16, T[38]);
  1577. b = HH(b, c, d, a, M_offset_10, 23, T[39]);
  1578. a = HH(a, b, c, d, M_offset_13, 4, T[40]);
  1579. d = HH(d, a, b, c, M_offset_0, 11, T[41]);
  1580. c = HH(c, d, a, b, M_offset_3, 16, T[42]);
  1581. b = HH(b, c, d, a, M_offset_6, 23, T[43]);
  1582. a = HH(a, b, c, d, M_offset_9, 4, T[44]);
  1583. d = HH(d, a, b, c, M_offset_12, 11, T[45]);
  1584. c = HH(c, d, a, b, M_offset_15, 16, T[46]);
  1585. b = HH(b, c, d, a, M_offset_2, 23, T[47]);
  1586. a = II(a, b, c, d, M_offset_0, 6, T[48]);
  1587. d = II(d, a, b, c, M_offset_7, 10, T[49]);
  1588. c = II(c, d, a, b, M_offset_14, 15, T[50]);
  1589. b = II(b, c, d, a, M_offset_5, 21, T[51]);
  1590. a = II(a, b, c, d, M_offset_12, 6, T[52]);
  1591. d = II(d, a, b, c, M_offset_3, 10, T[53]);
  1592. c = II(c, d, a, b, M_offset_10, 15, T[54]);
  1593. b = II(b, c, d, a, M_offset_1, 21, T[55]);
  1594. a = II(a, b, c, d, M_offset_8, 6, T[56]);
  1595. d = II(d, a, b, c, M_offset_15, 10, T[57]);
  1596. c = II(c, d, a, b, M_offset_6, 15, T[58]);
  1597. b = II(b, c, d, a, M_offset_13, 21, T[59]);
  1598. a = II(a, b, c, d, M_offset_4, 6, T[60]);
  1599. d = II(d, a, b, c, M_offset_11, 10, T[61]);
  1600. c = II(c, d, a, b, M_offset_2, 15, T[62]);
  1601. b = II(b, c, d, a, M_offset_9, 21, T[63]);
  1602. // Intermediate hash value
  1603. H[0] = (H[0] + a) | 0;
  1604. H[1] = (H[1] + b) | 0;
  1605. H[2] = (H[2] + c) | 0;
  1606. H[3] = (H[3] + d) | 0;
  1607. },
  1608. _doFinalize: function () {
  1609. // Shortcuts
  1610. var data = this._data;
  1611. var dataWords = data.words;
  1612. var nBitsTotal = this._nDataBytes * 8;
  1613. var nBitsLeft = data.sigBytes * 8;
  1614. // Add padding
  1615. dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
  1616. var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
  1617. var nBitsTotalL = nBitsTotal;
  1618. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
  1619. (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
  1620. (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)
  1621. );
  1622. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
  1623. (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
  1624. (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)
  1625. );
  1626. data.sigBytes = (dataWords.length + 1) * 4;
  1627. // Hash final blocks
  1628. this._process();
  1629. // Shortcuts
  1630. var hash = this._hash;
  1631. var H = hash.words;
  1632. // Swap endian
  1633. for (var i = 0; i < 4; i++) {
  1634. // Shortcut
  1635. var H_i = H[i];
  1636. H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
  1637. (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
  1638. }
  1639. // Return final computed hash
  1640. return hash;
  1641. },
  1642. clone: function () {
  1643. var clone = Hasher.clone.call(this);
  1644. clone._hash = this._hash.clone();
  1645. return clone;
  1646. }
  1647. });
  1648. function FF(a, b, c, d, x, s, t) {
  1649. var n = a + ((b & c) | (~b & d)) + x + t;
  1650. return ((n << s) | (n >>> (32 - s))) + b;
  1651. }
  1652. function GG(a, b, c, d, x, s, t) {
  1653. var n = a + ((b & d) | (c & ~d)) + x + t;
  1654. return ((n << s) | (n >>> (32 - s))) + b;
  1655. }
  1656. function HH(a, b, c, d, x, s, t) {
  1657. var n = a + (b ^ c ^ d) + x + t;
  1658. return ((n << s) | (n >>> (32 - s))) + b;
  1659. }
  1660. function II(a, b, c, d, x, s, t) {
  1661. var n = a + (c ^ (b | ~d)) + x + t;
  1662. return ((n << s) | (n >>> (32 - s))) + b;
  1663. }
  1664. /**
  1665. * Shortcut function to the hasher's object interface.
  1666. *
  1667. * @param {WordArray|string} message The message to hash.
  1668. *
  1669. * @return {WordArray} The hash.
  1670. *
  1671. * @static
  1672. *
  1673. * @example
  1674. *
  1675. * var hash = CryptoJS.MD5('message');
  1676. * var hash = CryptoJS.MD5(wordArray);
  1677. */
  1678. C.MD5 = Hasher._createHelper(MD5);
  1679. /**
  1680. * Shortcut function to the HMAC's object interface.
  1681. *
  1682. * @param {WordArray|string} message The message to hash.
  1683. * @param {WordArray|string} key The secret key.
  1684. *
  1685. * @return {WordArray} The HMAC.
  1686. *
  1687. * @static
  1688. *
  1689. * @example
  1690. *
  1691. * var hmac = CryptoJS.HmacMD5(message, key);
  1692. */
  1693. C.HmacMD5 = Hasher._createHmacHelper(MD5);
  1694. }(Math));
  1695. return CryptoJS.MD5;
  1696. }));
  1697. }, function(modId) { var map = {"./core":1733984946567}; return __REQUIRE__(map[modId], modId); })
  1698. __DEFINE__(1733984946574, function(require, module, exports) {
  1699. ;(function (root, factory) {
  1700. if (typeof exports === "object") {
  1701. // CommonJS
  1702. module.exports = exports = factory(require("./core"));
  1703. }
  1704. else if (typeof define === "function" && define.amd) {
  1705. // AMD
  1706. define(["./core"], factory);
  1707. }
  1708. else {
  1709. // Global (browser)
  1710. factory(root.CryptoJS);
  1711. }
  1712. }(this, function (CryptoJS) {
  1713. (function () {
  1714. // Shortcuts
  1715. var C = CryptoJS;
  1716. var C_lib = C.lib;
  1717. var WordArray = C_lib.WordArray;
  1718. var Hasher = C_lib.Hasher;
  1719. var C_algo = C.algo;
  1720. // Reusable object
  1721. var W = [];
  1722. /**
  1723. * SHA-1 hash algorithm.
  1724. */
  1725. var SHA1 = C_algo.SHA1 = Hasher.extend({
  1726. _doReset: function () {
  1727. this._hash = new WordArray.init([
  1728. 0x67452301, 0xefcdab89,
  1729. 0x98badcfe, 0x10325476,
  1730. 0xc3d2e1f0
  1731. ]);
  1732. },
  1733. _doProcessBlock: function (M, offset) {
  1734. // Shortcut
  1735. var H = this._hash.words;
  1736. // Working variables
  1737. var a = H[0];
  1738. var b = H[1];
  1739. var c = H[2];
  1740. var d = H[3];
  1741. var e = H[4];
  1742. // Computation
  1743. for (var i = 0; i < 80; i++) {
  1744. if (i < 16) {
  1745. W[i] = M[offset + i] | 0;
  1746. } else {
  1747. var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
  1748. W[i] = (n << 1) | (n >>> 31);
  1749. }
  1750. var t = ((a << 5) | (a >>> 27)) + e + W[i];
  1751. if (i < 20) {
  1752. t += ((b & c) | (~b & d)) + 0x5a827999;
  1753. } else if (i < 40) {
  1754. t += (b ^ c ^ d) + 0x6ed9eba1;
  1755. } else if (i < 60) {
  1756. t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;
  1757. } else /* if (i < 80) */ {
  1758. t += (b ^ c ^ d) - 0x359d3e2a;
  1759. }
  1760. e = d;
  1761. d = c;
  1762. c = (b << 30) | (b >>> 2);
  1763. b = a;
  1764. a = t;
  1765. }
  1766. // Intermediate hash value
  1767. H[0] = (H[0] + a) | 0;
  1768. H[1] = (H[1] + b) | 0;
  1769. H[2] = (H[2] + c) | 0;
  1770. H[3] = (H[3] + d) | 0;
  1771. H[4] = (H[4] + e) | 0;
  1772. },
  1773. _doFinalize: function () {
  1774. // Shortcuts
  1775. var data = this._data;
  1776. var dataWords = data.words;
  1777. var nBitsTotal = this._nDataBytes * 8;
  1778. var nBitsLeft = data.sigBytes * 8;
  1779. // Add padding
  1780. dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
  1781. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
  1782. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
  1783. data.sigBytes = dataWords.length * 4;
  1784. // Hash final blocks
  1785. this._process();
  1786. // Return final computed hash
  1787. return this._hash;
  1788. },
  1789. clone: function () {
  1790. var clone = Hasher.clone.call(this);
  1791. clone._hash = this._hash.clone();
  1792. return clone;
  1793. }
  1794. });
  1795. /**
  1796. * Shortcut function to the hasher's object interface.
  1797. *
  1798. * @param {WordArray|string} message The message to hash.
  1799. *
  1800. * @return {WordArray} The hash.
  1801. *
  1802. * @static
  1803. *
  1804. * @example
  1805. *
  1806. * var hash = CryptoJS.SHA1('message');
  1807. * var hash = CryptoJS.SHA1(wordArray);
  1808. */
  1809. C.SHA1 = Hasher._createHelper(SHA1);
  1810. /**
  1811. * Shortcut function to the HMAC's object interface.
  1812. *
  1813. * @param {WordArray|string} message The message to hash.
  1814. * @param {WordArray|string} key The secret key.
  1815. *
  1816. * @return {WordArray} The HMAC.
  1817. *
  1818. * @static
  1819. *
  1820. * @example
  1821. *
  1822. * var hmac = CryptoJS.HmacSHA1(message, key);
  1823. */
  1824. C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
  1825. }());
  1826. return CryptoJS.SHA1;
  1827. }));
  1828. }, function(modId) { var map = {"./core":1733984946567}; return __REQUIRE__(map[modId], modId); })
  1829. __DEFINE__(1733984946575, function(require, module, exports) {
  1830. ;(function (root, factory) {
  1831. if (typeof exports === "object") {
  1832. // CommonJS
  1833. module.exports = exports = factory(require("./core"));
  1834. }
  1835. else if (typeof define === "function" && define.amd) {
  1836. // AMD
  1837. define(["./core"], factory);
  1838. }
  1839. else {
  1840. // Global (browser)
  1841. factory(root.CryptoJS);
  1842. }
  1843. }(this, function (CryptoJS) {
  1844. (function (Math) {
  1845. // Shortcuts
  1846. var C = CryptoJS;
  1847. var C_lib = C.lib;
  1848. var WordArray = C_lib.WordArray;
  1849. var Hasher = C_lib.Hasher;
  1850. var C_algo = C.algo;
  1851. // Initialization and round constants tables
  1852. var H = [];
  1853. var K = [];
  1854. // Compute constants
  1855. (function () {
  1856. function isPrime(n) {
  1857. var sqrtN = Math.sqrt(n);
  1858. for (var factor = 2; factor <= sqrtN; factor++) {
  1859. if (!(n % factor)) {
  1860. return false;
  1861. }
  1862. }
  1863. return true;
  1864. }
  1865. function getFractionalBits(n) {
  1866. return ((n - (n | 0)) * 0x100000000) | 0;
  1867. }
  1868. var n = 2;
  1869. var nPrime = 0;
  1870. while (nPrime < 64) {
  1871. if (isPrime(n)) {
  1872. if (nPrime < 8) {
  1873. H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
  1874. }
  1875. K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
  1876. nPrime++;
  1877. }
  1878. n++;
  1879. }
  1880. }());
  1881. // Reusable object
  1882. var W = [];
  1883. /**
  1884. * SHA-256 hash algorithm.
  1885. */
  1886. var SHA256 = C_algo.SHA256 = Hasher.extend({
  1887. _doReset: function () {
  1888. this._hash = new WordArray.init(H.slice(0));
  1889. },
  1890. _doProcessBlock: function (M, offset) {
  1891. // Shortcut
  1892. var H = this._hash.words;
  1893. // Working variables
  1894. var a = H[0];
  1895. var b = H[1];
  1896. var c = H[2];
  1897. var d = H[3];
  1898. var e = H[4];
  1899. var f = H[5];
  1900. var g = H[6];
  1901. var h = H[7];
  1902. // Computation
  1903. for (var i = 0; i < 64; i++) {
  1904. if (i < 16) {
  1905. W[i] = M[offset + i] | 0;
  1906. } else {
  1907. var gamma0x = W[i - 15];
  1908. var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^
  1909. ((gamma0x << 14) | (gamma0x >>> 18)) ^
  1910. (gamma0x >>> 3);
  1911. var gamma1x = W[i - 2];
  1912. var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^
  1913. ((gamma1x << 13) | (gamma1x >>> 19)) ^
  1914. (gamma1x >>> 10);
  1915. W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
  1916. }
  1917. var ch = (e & f) ^ (~e & g);
  1918. var maj = (a & b) ^ (a & c) ^ (b & c);
  1919. var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));
  1920. var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));
  1921. var t1 = h + sigma1 + ch + K[i] + W[i];
  1922. var t2 = sigma0 + maj;
  1923. h = g;
  1924. g = f;
  1925. f = e;
  1926. e = (d + t1) | 0;
  1927. d = c;
  1928. c = b;
  1929. b = a;
  1930. a = (t1 + t2) | 0;
  1931. }
  1932. // Intermediate hash value
  1933. H[0] = (H[0] + a) | 0;
  1934. H[1] = (H[1] + b) | 0;
  1935. H[2] = (H[2] + c) | 0;
  1936. H[3] = (H[3] + d) | 0;
  1937. H[4] = (H[4] + e) | 0;
  1938. H[5] = (H[5] + f) | 0;
  1939. H[6] = (H[6] + g) | 0;
  1940. H[7] = (H[7] + h) | 0;
  1941. },
  1942. _doFinalize: function () {
  1943. // Shortcuts
  1944. var data = this._data;
  1945. var dataWords = data.words;
  1946. var nBitsTotal = this._nDataBytes * 8;
  1947. var nBitsLeft = data.sigBytes * 8;
  1948. // Add padding
  1949. dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
  1950. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
  1951. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
  1952. data.sigBytes = dataWords.length * 4;
  1953. // Hash final blocks
  1954. this._process();
  1955. // Return final computed hash
  1956. return this._hash;
  1957. },
  1958. clone: function () {
  1959. var clone = Hasher.clone.call(this);
  1960. clone._hash = this._hash.clone();
  1961. return clone;
  1962. }
  1963. });
  1964. /**
  1965. * Shortcut function to the hasher's object interface.
  1966. *
  1967. * @param {WordArray|string} message The message to hash.
  1968. *
  1969. * @return {WordArray} The hash.
  1970. *
  1971. * @static
  1972. *
  1973. * @example
  1974. *
  1975. * var hash = CryptoJS.SHA256('message');
  1976. * var hash = CryptoJS.SHA256(wordArray);
  1977. */
  1978. C.SHA256 = Hasher._createHelper(SHA256);
  1979. /**
  1980. * Shortcut function to the HMAC's object interface.
  1981. *
  1982. * @param {WordArray|string} message The message to hash.
  1983. * @param {WordArray|string} key The secret key.
  1984. *
  1985. * @return {WordArray} The HMAC.
  1986. *
  1987. * @static
  1988. *
  1989. * @example
  1990. *
  1991. * var hmac = CryptoJS.HmacSHA256(message, key);
  1992. */
  1993. C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
  1994. }(Math));
  1995. return CryptoJS.SHA256;
  1996. }));
  1997. }, function(modId) { var map = {"./core":1733984946567}; return __REQUIRE__(map[modId], modId); })
  1998. __DEFINE__(1733984946576, function(require, module, exports) {
  1999. ;(function (root, factory, undef) {
  2000. if (typeof exports === "object") {
  2001. // CommonJS
  2002. module.exports = exports = factory(require("./core"), require("./sha256"));
  2003. }
  2004. else if (typeof define === "function" && define.amd) {
  2005. // AMD
  2006. define(["./core", "./sha256"], factory);
  2007. }
  2008. else {
  2009. // Global (browser)
  2010. factory(root.CryptoJS);
  2011. }
  2012. }(this, function (CryptoJS) {
  2013. (function () {
  2014. // Shortcuts
  2015. var C = CryptoJS;
  2016. var C_lib = C.lib;
  2017. var WordArray = C_lib.WordArray;
  2018. var C_algo = C.algo;
  2019. var SHA256 = C_algo.SHA256;
  2020. /**
  2021. * SHA-224 hash algorithm.
  2022. */
  2023. var SHA224 = C_algo.SHA224 = SHA256.extend({
  2024. _doReset: function () {
  2025. this._hash = new WordArray.init([
  2026. 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
  2027. 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
  2028. ]);
  2029. },
  2030. _doFinalize: function () {
  2031. var hash = SHA256._doFinalize.call(this);
  2032. hash.sigBytes -= 4;
  2033. return hash;
  2034. }
  2035. });
  2036. /**
  2037. * Shortcut function to the hasher's object interface.
  2038. *
  2039. * @param {WordArray|string} message The message to hash.
  2040. *
  2041. * @return {WordArray} The hash.
  2042. *
  2043. * @static
  2044. *
  2045. * @example
  2046. *
  2047. * var hash = CryptoJS.SHA224('message');
  2048. * var hash = CryptoJS.SHA224(wordArray);
  2049. */
  2050. C.SHA224 = SHA256._createHelper(SHA224);
  2051. /**
  2052. * Shortcut function to the HMAC's object interface.
  2053. *
  2054. * @param {WordArray|string} message The message to hash.
  2055. * @param {WordArray|string} key The secret key.
  2056. *
  2057. * @return {WordArray} The HMAC.
  2058. *
  2059. * @static
  2060. *
  2061. * @example
  2062. *
  2063. * var hmac = CryptoJS.HmacSHA224(message, key);
  2064. */
  2065. C.HmacSHA224 = SHA256._createHmacHelper(SHA224);
  2066. }());
  2067. return CryptoJS.SHA224;
  2068. }));
  2069. }, function(modId) { var map = {"./core":1733984946567,"./sha256":1733984946575}; return __REQUIRE__(map[modId], modId); })
  2070. __DEFINE__(1733984946577, function(require, module, exports) {
  2071. ;(function (root, factory, undef) {
  2072. if (typeof exports === "object") {
  2073. // CommonJS
  2074. module.exports = exports = factory(require("./core"), require("./x64-core"));
  2075. }
  2076. else if (typeof define === "function" && define.amd) {
  2077. // AMD
  2078. define(["./core", "./x64-core"], factory);
  2079. }
  2080. else {
  2081. // Global (browser)
  2082. factory(root.CryptoJS);
  2083. }
  2084. }(this, function (CryptoJS) {
  2085. (function () {
  2086. // Shortcuts
  2087. var C = CryptoJS;
  2088. var C_lib = C.lib;
  2089. var Hasher = C_lib.Hasher;
  2090. var C_x64 = C.x64;
  2091. var X64Word = C_x64.Word;
  2092. var X64WordArray = C_x64.WordArray;
  2093. var C_algo = C.algo;
  2094. function X64Word_create() {
  2095. return X64Word.create.apply(X64Word, arguments);
  2096. }
  2097. // Constants
  2098. var K = [
  2099. X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd),
  2100. X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc),
  2101. X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019),
  2102. X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118),
  2103. X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe),
  2104. X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2),
  2105. X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1),
  2106. X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694),
  2107. X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3),
  2108. X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65),
  2109. X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483),
  2110. X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5),
  2111. X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210),
  2112. X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4),
  2113. X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725),
  2114. X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70),
  2115. X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926),
  2116. X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df),
  2117. X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8),
  2118. X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b),
  2119. X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001),
  2120. X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30),
  2121. X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910),
  2122. X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8),
  2123. X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53),
  2124. X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8),
  2125. X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb),
  2126. X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3),
  2127. X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60),
  2128. X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec),
  2129. X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9),
  2130. X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b),
  2131. X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207),
  2132. X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178),
  2133. X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6),
  2134. X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b),
  2135. X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493),
  2136. X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c),
  2137. X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a),
  2138. X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)
  2139. ];
  2140. // Reusable objects
  2141. var W = [];
  2142. (function () {
  2143. for (var i = 0; i < 80; i++) {
  2144. W[i] = X64Word_create();
  2145. }
  2146. }());
  2147. /**
  2148. * SHA-512 hash algorithm.
  2149. */
  2150. var SHA512 = C_algo.SHA512 = Hasher.extend({
  2151. _doReset: function () {
  2152. this._hash = new X64WordArray.init([
  2153. new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b),
  2154. new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1),
  2155. new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f),
  2156. new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)
  2157. ]);
  2158. },
  2159. _doProcessBlock: function (M, offset) {
  2160. // Shortcuts
  2161. var H = this._hash.words;
  2162. var H0 = H[0];
  2163. var H1 = H[1];
  2164. var H2 = H[2];
  2165. var H3 = H[3];
  2166. var H4 = H[4];
  2167. var H5 = H[5];
  2168. var H6 = H[6];
  2169. var H7 = H[7];
  2170. var H0h = H0.high;
  2171. var H0l = H0.low;
  2172. var H1h = H1.high;
  2173. var H1l = H1.low;
  2174. var H2h = H2.high;
  2175. var H2l = H2.low;
  2176. var H3h = H3.high;
  2177. var H3l = H3.low;
  2178. var H4h = H4.high;
  2179. var H4l = H4.low;
  2180. var H5h = H5.high;
  2181. var H5l = H5.low;
  2182. var H6h = H6.high;
  2183. var H6l = H6.low;
  2184. var H7h = H7.high;
  2185. var H7l = H7.low;
  2186. // Working variables
  2187. var ah = H0h;
  2188. var al = H0l;
  2189. var bh = H1h;
  2190. var bl = H1l;
  2191. var ch = H2h;
  2192. var cl = H2l;
  2193. var dh = H3h;
  2194. var dl = H3l;
  2195. var eh = H4h;
  2196. var el = H4l;
  2197. var fh = H5h;
  2198. var fl = H5l;
  2199. var gh = H6h;
  2200. var gl = H6l;
  2201. var hh = H7h;
  2202. var hl = H7l;
  2203. // Rounds
  2204. for (var i = 0; i < 80; i++) {
  2205. var Wil;
  2206. var Wih;
  2207. // Shortcut
  2208. var Wi = W[i];
  2209. // Extend message
  2210. if (i < 16) {
  2211. Wih = Wi.high = M[offset + i * 2] | 0;
  2212. Wil = Wi.low = M[offset + i * 2 + 1] | 0;
  2213. } else {
  2214. // Gamma0
  2215. var gamma0x = W[i - 15];
  2216. var gamma0xh = gamma0x.high;
  2217. var gamma0xl = gamma0x.low;
  2218. var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7);
  2219. var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25));
  2220. // Gamma1
  2221. var gamma1x = W[i - 2];
  2222. var gamma1xh = gamma1x.high;
  2223. var gamma1xl = gamma1x.low;
  2224. var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6);
  2225. var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26));
  2226. // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
  2227. var Wi7 = W[i - 7];
  2228. var Wi7h = Wi7.high;
  2229. var Wi7l = Wi7.low;
  2230. var Wi16 = W[i - 16];
  2231. var Wi16h = Wi16.high;
  2232. var Wi16l = Wi16.low;
  2233. Wil = gamma0l + Wi7l;
  2234. Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0);
  2235. Wil = Wil + gamma1l;
  2236. Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0);
  2237. Wil = Wil + Wi16l;
  2238. Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0);
  2239. Wi.high = Wih;
  2240. Wi.low = Wil;
  2241. }
  2242. var chh = (eh & fh) ^ (~eh & gh);
  2243. var chl = (el & fl) ^ (~el & gl);
  2244. var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch);
  2245. var majl = (al & bl) ^ (al & cl) ^ (bl & cl);
  2246. var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7));
  2247. var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7));
  2248. var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9));
  2249. var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9));
  2250. // t1 = h + sigma1 + ch + K[i] + W[i]
  2251. var Ki = K[i];
  2252. var Kih = Ki.high;
  2253. var Kil = Ki.low;
  2254. var t1l = hl + sigma1l;
  2255. var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0);
  2256. var t1l = t1l + chl;
  2257. var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0);
  2258. var t1l = t1l + Kil;
  2259. var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0);
  2260. var t1l = t1l + Wil;
  2261. var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0);
  2262. // t2 = sigma0 + maj
  2263. var t2l = sigma0l + majl;
  2264. var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0);
  2265. // Update working variables
  2266. hh = gh;
  2267. hl = gl;
  2268. gh = fh;
  2269. gl = fl;
  2270. fh = eh;
  2271. fl = el;
  2272. el = (dl + t1l) | 0;
  2273. eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0;
  2274. dh = ch;
  2275. dl = cl;
  2276. ch = bh;
  2277. cl = bl;
  2278. bh = ah;
  2279. bl = al;
  2280. al = (t1l + t2l) | 0;
  2281. ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0;
  2282. }
  2283. // Intermediate hash value
  2284. H0l = H0.low = (H0l + al);
  2285. H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0));
  2286. H1l = H1.low = (H1l + bl);
  2287. H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0));
  2288. H2l = H2.low = (H2l + cl);
  2289. H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0));
  2290. H3l = H3.low = (H3l + dl);
  2291. H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0));
  2292. H4l = H4.low = (H4l + el);
  2293. H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0));
  2294. H5l = H5.low = (H5l + fl);
  2295. H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0));
  2296. H6l = H6.low = (H6l + gl);
  2297. H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0));
  2298. H7l = H7.low = (H7l + hl);
  2299. H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0));
  2300. },
  2301. _doFinalize: function () {
  2302. // Shortcuts
  2303. var data = this._data;
  2304. var dataWords = data.words;
  2305. var nBitsTotal = this._nDataBytes * 8;
  2306. var nBitsLeft = data.sigBytes * 8;
  2307. // Add padding
  2308. dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
  2309. dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);
  2310. dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal;
  2311. data.sigBytes = dataWords.length * 4;
  2312. // Hash final blocks
  2313. this._process();
  2314. // Convert hash to 32-bit word array before returning
  2315. var hash = this._hash.toX32();
  2316. // Return final computed hash
  2317. return hash;
  2318. },
  2319. clone: function () {
  2320. var clone = Hasher.clone.call(this);
  2321. clone._hash = this._hash.clone();
  2322. return clone;
  2323. },
  2324. blockSize: 1024/32
  2325. });
  2326. /**
  2327. * Shortcut function to the hasher's object interface.
  2328. *
  2329. * @param {WordArray|string} message The message to hash.
  2330. *
  2331. * @return {WordArray} The hash.
  2332. *
  2333. * @static
  2334. *
  2335. * @example
  2336. *
  2337. * var hash = CryptoJS.SHA512('message');
  2338. * var hash = CryptoJS.SHA512(wordArray);
  2339. */
  2340. C.SHA512 = Hasher._createHelper(SHA512);
  2341. /**
  2342. * Shortcut function to the HMAC's object interface.
  2343. *
  2344. * @param {WordArray|string} message The message to hash.
  2345. * @param {WordArray|string} key The secret key.
  2346. *
  2347. * @return {WordArray} The HMAC.
  2348. *
  2349. * @static
  2350. *
  2351. * @example
  2352. *
  2353. * var hmac = CryptoJS.HmacSHA512(message, key);
  2354. */
  2355. C.HmacSHA512 = Hasher._createHmacHelper(SHA512);
  2356. }());
  2357. return CryptoJS.SHA512;
  2358. }));
  2359. }, function(modId) { var map = {"./core":1733984946567,"./x64-core":1733984946568}; return __REQUIRE__(map[modId], modId); })
  2360. __DEFINE__(1733984946578, function(require, module, exports) {
  2361. ;(function (root, factory, undef) {
  2362. if (typeof exports === "object") {
  2363. // CommonJS
  2364. module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"));
  2365. }
  2366. else if (typeof define === "function" && define.amd) {
  2367. // AMD
  2368. define(["./core", "./x64-core", "./sha512"], factory);
  2369. }
  2370. else {
  2371. // Global (browser)
  2372. factory(root.CryptoJS);
  2373. }
  2374. }(this, function (CryptoJS) {
  2375. (function () {
  2376. // Shortcuts
  2377. var C = CryptoJS;
  2378. var C_x64 = C.x64;
  2379. var X64Word = C_x64.Word;
  2380. var X64WordArray = C_x64.WordArray;
  2381. var C_algo = C.algo;
  2382. var SHA512 = C_algo.SHA512;
  2383. /**
  2384. * SHA-384 hash algorithm.
  2385. */
  2386. var SHA384 = C_algo.SHA384 = SHA512.extend({
  2387. _doReset: function () {
  2388. this._hash = new X64WordArray.init([
  2389. new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507),
  2390. new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939),
  2391. new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511),
  2392. new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)
  2393. ]);
  2394. },
  2395. _doFinalize: function () {
  2396. var hash = SHA512._doFinalize.call(this);
  2397. hash.sigBytes -= 16;
  2398. return hash;
  2399. }
  2400. });
  2401. /**
  2402. * Shortcut function to the hasher's object interface.
  2403. *
  2404. * @param {WordArray|string} message The message to hash.
  2405. *
  2406. * @return {WordArray} The hash.
  2407. *
  2408. * @static
  2409. *
  2410. * @example
  2411. *
  2412. * var hash = CryptoJS.SHA384('message');
  2413. * var hash = CryptoJS.SHA384(wordArray);
  2414. */
  2415. C.SHA384 = SHA512._createHelper(SHA384);
  2416. /**
  2417. * Shortcut function to the HMAC's object interface.
  2418. *
  2419. * @param {WordArray|string} message The message to hash.
  2420. * @param {WordArray|string} key The secret key.
  2421. *
  2422. * @return {WordArray} The HMAC.
  2423. *
  2424. * @static
  2425. *
  2426. * @example
  2427. *
  2428. * var hmac = CryptoJS.HmacSHA384(message, key);
  2429. */
  2430. C.HmacSHA384 = SHA512._createHmacHelper(SHA384);
  2431. }());
  2432. return CryptoJS.SHA384;
  2433. }));
  2434. }, function(modId) { var map = {"./core":1733984946567,"./x64-core":1733984946568,"./sha512":1733984946577}; return __REQUIRE__(map[modId], modId); })
  2435. __DEFINE__(1733984946579, function(require, module, exports) {
  2436. ;(function (root, factory, undef) {
  2437. if (typeof exports === "object") {
  2438. // CommonJS
  2439. module.exports = exports = factory(require("./core"), require("./x64-core"));
  2440. }
  2441. else if (typeof define === "function" && define.amd) {
  2442. // AMD
  2443. define(["./core", "./x64-core"], factory);
  2444. }
  2445. else {
  2446. // Global (browser)
  2447. factory(root.CryptoJS);
  2448. }
  2449. }(this, function (CryptoJS) {
  2450. (function (Math) {
  2451. // Shortcuts
  2452. var C = CryptoJS;
  2453. var C_lib = C.lib;
  2454. var WordArray = C_lib.WordArray;
  2455. var Hasher = C_lib.Hasher;
  2456. var C_x64 = C.x64;
  2457. var X64Word = C_x64.Word;
  2458. var C_algo = C.algo;
  2459. // Constants tables
  2460. var RHO_OFFSETS = [];
  2461. var PI_INDEXES = [];
  2462. var ROUND_CONSTANTS = [];
  2463. // Compute Constants
  2464. (function () {
  2465. // Compute rho offset constants
  2466. var x = 1, y = 0;
  2467. for (var t = 0; t < 24; t++) {
  2468. RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64;
  2469. var newX = y % 5;
  2470. var newY = (2 * x + 3 * y) % 5;
  2471. x = newX;
  2472. y = newY;
  2473. }
  2474. // Compute pi index constants
  2475. for (var x = 0; x < 5; x++) {
  2476. for (var y = 0; y < 5; y++) {
  2477. PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5;
  2478. }
  2479. }
  2480. // Compute round constants
  2481. var LFSR = 0x01;
  2482. for (var i = 0; i < 24; i++) {
  2483. var roundConstantMsw = 0;
  2484. var roundConstantLsw = 0;
  2485. for (var j = 0; j < 7; j++) {
  2486. if (LFSR & 0x01) {
  2487. var bitPosition = (1 << j) - 1;
  2488. if (bitPosition < 32) {
  2489. roundConstantLsw ^= 1 << bitPosition;
  2490. } else /* if (bitPosition >= 32) */ {
  2491. roundConstantMsw ^= 1 << (bitPosition - 32);
  2492. }
  2493. }
  2494. // Compute next LFSR
  2495. if (LFSR & 0x80) {
  2496. // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1
  2497. LFSR = (LFSR << 1) ^ 0x71;
  2498. } else {
  2499. LFSR <<= 1;
  2500. }
  2501. }
  2502. ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw);
  2503. }
  2504. }());
  2505. // Reusable objects for temporary values
  2506. var T = [];
  2507. (function () {
  2508. for (var i = 0; i < 25; i++) {
  2509. T[i] = X64Word.create();
  2510. }
  2511. }());
  2512. /**
  2513. * SHA-3 hash algorithm.
  2514. */
  2515. var SHA3 = C_algo.SHA3 = Hasher.extend({
  2516. /**
  2517. * Configuration options.
  2518. *
  2519. * @property {number} outputLength
  2520. * The desired number of bits in the output hash.
  2521. * Only values permitted are: 224, 256, 384, 512.
  2522. * Default: 512
  2523. */
  2524. cfg: Hasher.cfg.extend({
  2525. outputLength: 512
  2526. }),
  2527. _doReset: function () {
  2528. var state = this._state = []
  2529. for (var i = 0; i < 25; i++) {
  2530. state[i] = new X64Word.init();
  2531. }
  2532. this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
  2533. },
  2534. _doProcessBlock: function (M, offset) {
  2535. // Shortcuts
  2536. var state = this._state;
  2537. var nBlockSizeLanes = this.blockSize / 2;
  2538. // Absorb
  2539. for (var i = 0; i < nBlockSizeLanes; i++) {
  2540. // Shortcuts
  2541. var M2i = M[offset + 2 * i];
  2542. var M2i1 = M[offset + 2 * i + 1];
  2543. // Swap endian
  2544. M2i = (
  2545. (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) |
  2546. (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00)
  2547. );
  2548. M2i1 = (
  2549. (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) |
  2550. (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00)
  2551. );
  2552. // Absorb message into state
  2553. var lane = state[i];
  2554. lane.high ^= M2i1;
  2555. lane.low ^= M2i;
  2556. }
  2557. // Rounds
  2558. for (var round = 0; round < 24; round++) {
  2559. // Theta
  2560. for (var x = 0; x < 5; x++) {
  2561. // Mix column lanes
  2562. var tMsw = 0, tLsw = 0;
  2563. for (var y = 0; y < 5; y++) {
  2564. var lane = state[x + 5 * y];
  2565. tMsw ^= lane.high;
  2566. tLsw ^= lane.low;
  2567. }
  2568. // Temporary values
  2569. var Tx = T[x];
  2570. Tx.high = tMsw;
  2571. Tx.low = tLsw;
  2572. }
  2573. for (var x = 0; x < 5; x++) {
  2574. // Shortcuts
  2575. var Tx4 = T[(x + 4) % 5];
  2576. var Tx1 = T[(x + 1) % 5];
  2577. var Tx1Msw = Tx1.high;
  2578. var Tx1Lsw = Tx1.low;
  2579. // Mix surrounding columns
  2580. var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31));
  2581. var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31));
  2582. for (var y = 0; y < 5; y++) {
  2583. var lane = state[x + 5 * y];
  2584. lane.high ^= tMsw;
  2585. lane.low ^= tLsw;
  2586. }
  2587. }
  2588. // Rho Pi
  2589. for (var laneIndex = 1; laneIndex < 25; laneIndex++) {
  2590. var tMsw;
  2591. var tLsw;
  2592. // Shortcuts
  2593. var lane = state[laneIndex];
  2594. var laneMsw = lane.high;
  2595. var laneLsw = lane.low;
  2596. var rhoOffset = RHO_OFFSETS[laneIndex];
  2597. // Rotate lanes
  2598. if (rhoOffset < 32) {
  2599. tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset));
  2600. tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset));
  2601. } else /* if (rhoOffset >= 32) */ {
  2602. tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset));
  2603. tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset));
  2604. }
  2605. // Transpose lanes
  2606. var TPiLane = T[PI_INDEXES[laneIndex]];
  2607. TPiLane.high = tMsw;
  2608. TPiLane.low = tLsw;
  2609. }
  2610. // Rho pi at x = y = 0
  2611. var T0 = T[0];
  2612. var state0 = state[0];
  2613. T0.high = state0.high;
  2614. T0.low = state0.low;
  2615. // Chi
  2616. for (var x = 0; x < 5; x++) {
  2617. for (var y = 0; y < 5; y++) {
  2618. // Shortcuts
  2619. var laneIndex = x + 5 * y;
  2620. var lane = state[laneIndex];
  2621. var TLane = T[laneIndex];
  2622. var Tx1Lane = T[((x + 1) % 5) + 5 * y];
  2623. var Tx2Lane = T[((x + 2) % 5) + 5 * y];
  2624. // Mix rows
  2625. lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high);
  2626. lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low);
  2627. }
  2628. }
  2629. // Iota
  2630. var lane = state[0];
  2631. var roundConstant = ROUND_CONSTANTS[round];
  2632. lane.high ^= roundConstant.high;
  2633. lane.low ^= roundConstant.low;
  2634. }
  2635. },
  2636. _doFinalize: function () {
  2637. // Shortcuts
  2638. var data = this._data;
  2639. var dataWords = data.words;
  2640. var nBitsTotal = this._nDataBytes * 8;
  2641. var nBitsLeft = data.sigBytes * 8;
  2642. var blockSizeBits = this.blockSize * 32;
  2643. // Add padding
  2644. dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32);
  2645. dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80;
  2646. data.sigBytes = dataWords.length * 4;
  2647. // Hash final blocks
  2648. this._process();
  2649. // Shortcuts
  2650. var state = this._state;
  2651. var outputLengthBytes = this.cfg.outputLength / 8;
  2652. var outputLengthLanes = outputLengthBytes / 8;
  2653. // Squeeze
  2654. var hashWords = [];
  2655. for (var i = 0; i < outputLengthLanes; i++) {
  2656. // Shortcuts
  2657. var lane = state[i];
  2658. var laneMsw = lane.high;
  2659. var laneLsw = lane.low;
  2660. // Swap endian
  2661. laneMsw = (
  2662. (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) |
  2663. (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00)
  2664. );
  2665. laneLsw = (
  2666. (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) |
  2667. (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00)
  2668. );
  2669. // Squeeze state to retrieve hash
  2670. hashWords.push(laneLsw);
  2671. hashWords.push(laneMsw);
  2672. }
  2673. // Return final computed hash
  2674. return new WordArray.init(hashWords, outputLengthBytes);
  2675. },
  2676. clone: function () {
  2677. var clone = Hasher.clone.call(this);
  2678. var state = clone._state = this._state.slice(0);
  2679. for (var i = 0; i < 25; i++) {
  2680. state[i] = state[i].clone();
  2681. }
  2682. return clone;
  2683. }
  2684. });
  2685. /**
  2686. * Shortcut function to the hasher's object interface.
  2687. *
  2688. * @param {WordArray|string} message The message to hash.
  2689. *
  2690. * @return {WordArray} The hash.
  2691. *
  2692. * @static
  2693. *
  2694. * @example
  2695. *
  2696. * var hash = CryptoJS.SHA3('message');
  2697. * var hash = CryptoJS.SHA3(wordArray);
  2698. */
  2699. C.SHA3 = Hasher._createHelper(SHA3);
  2700. /**
  2701. * Shortcut function to the HMAC's object interface.
  2702. *
  2703. * @param {WordArray|string} message The message to hash.
  2704. * @param {WordArray|string} key The secret key.
  2705. *
  2706. * @return {WordArray} The HMAC.
  2707. *
  2708. * @static
  2709. *
  2710. * @example
  2711. *
  2712. * var hmac = CryptoJS.HmacSHA3(message, key);
  2713. */
  2714. C.HmacSHA3 = Hasher._createHmacHelper(SHA3);
  2715. }(Math));
  2716. return CryptoJS.SHA3;
  2717. }));
  2718. }, function(modId) { var map = {"./core":1733984946567,"./x64-core":1733984946568}; return __REQUIRE__(map[modId], modId); })
  2719. __DEFINE__(1733984946580, function(require, module, exports) {
  2720. ;(function (root, factory) {
  2721. if (typeof exports === "object") {
  2722. // CommonJS
  2723. module.exports = exports = factory(require("./core"));
  2724. }
  2725. else if (typeof define === "function" && define.amd) {
  2726. // AMD
  2727. define(["./core"], factory);
  2728. }
  2729. else {
  2730. // Global (browser)
  2731. factory(root.CryptoJS);
  2732. }
  2733. }(this, function (CryptoJS) {
  2734. /** @preserve
  2735. (c) 2012 by Cédric Mesnil. All rights reserved.
  2736. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
  2737. - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2738. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  2739. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  2740. */
  2741. (function (Math) {
  2742. // Shortcuts
  2743. var C = CryptoJS;
  2744. var C_lib = C.lib;
  2745. var WordArray = C_lib.WordArray;
  2746. var Hasher = C_lib.Hasher;
  2747. var C_algo = C.algo;
  2748. // Constants table
  2749. var _zl = WordArray.create([
  2750. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  2751. 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
  2752. 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
  2753. 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
  2754. 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]);
  2755. var _zr = WordArray.create([
  2756. 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
  2757. 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
  2758. 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
  2759. 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
  2760. 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]);
  2761. var _sl = WordArray.create([
  2762. 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
  2763. 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
  2764. 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
  2765. 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
  2766. 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]);
  2767. var _sr = WordArray.create([
  2768. 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
  2769. 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
  2770. 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
  2771. 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
  2772. 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]);
  2773. var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]);
  2774. var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]);
  2775. /**
  2776. * RIPEMD160 hash algorithm.
  2777. */
  2778. var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({
  2779. _doReset: function () {
  2780. this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]);
  2781. },
  2782. _doProcessBlock: function (M, offset) {
  2783. // Swap endian
  2784. for (var i = 0; i < 16; i++) {
  2785. // Shortcuts
  2786. var offset_i = offset + i;
  2787. var M_offset_i = M[offset_i];
  2788. // Swap
  2789. M[offset_i] = (
  2790. (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
  2791. (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
  2792. );
  2793. }
  2794. // Shortcut
  2795. var H = this._hash.words;
  2796. var hl = _hl.words;
  2797. var hr = _hr.words;
  2798. var zl = _zl.words;
  2799. var zr = _zr.words;
  2800. var sl = _sl.words;
  2801. var sr = _sr.words;
  2802. // Working variables
  2803. var al, bl, cl, dl, el;
  2804. var ar, br, cr, dr, er;
  2805. ar = al = H[0];
  2806. br = bl = H[1];
  2807. cr = cl = H[2];
  2808. dr = dl = H[3];
  2809. er = el = H[4];
  2810. // Computation
  2811. var t;
  2812. for (var i = 0; i < 80; i += 1) {
  2813. t = (al + M[offset+zl[i]])|0;
  2814. if (i<16){
  2815. t += f1(bl,cl,dl) + hl[0];
  2816. } else if (i<32) {
  2817. t += f2(bl,cl,dl) + hl[1];
  2818. } else if (i<48) {
  2819. t += f3(bl,cl,dl) + hl[2];
  2820. } else if (i<64) {
  2821. t += f4(bl,cl,dl) + hl[3];
  2822. } else {// if (i<80) {
  2823. t += f5(bl,cl,dl) + hl[4];
  2824. }
  2825. t = t|0;
  2826. t = rotl(t,sl[i]);
  2827. t = (t+el)|0;
  2828. al = el;
  2829. el = dl;
  2830. dl = rotl(cl, 10);
  2831. cl = bl;
  2832. bl = t;
  2833. t = (ar + M[offset+zr[i]])|0;
  2834. if (i<16){
  2835. t += f5(br,cr,dr) + hr[0];
  2836. } else if (i<32) {
  2837. t += f4(br,cr,dr) + hr[1];
  2838. } else if (i<48) {
  2839. t += f3(br,cr,dr) + hr[2];
  2840. } else if (i<64) {
  2841. t += f2(br,cr,dr) + hr[3];
  2842. } else {// if (i<80) {
  2843. t += f1(br,cr,dr) + hr[4];
  2844. }
  2845. t = t|0;
  2846. t = rotl(t,sr[i]) ;
  2847. t = (t+er)|0;
  2848. ar = er;
  2849. er = dr;
  2850. dr = rotl(cr, 10);
  2851. cr = br;
  2852. br = t;
  2853. }
  2854. // Intermediate hash value
  2855. t = (H[1] + cl + dr)|0;
  2856. H[1] = (H[2] + dl + er)|0;
  2857. H[2] = (H[3] + el + ar)|0;
  2858. H[3] = (H[4] + al + br)|0;
  2859. H[4] = (H[0] + bl + cr)|0;
  2860. H[0] = t;
  2861. },
  2862. _doFinalize: function () {
  2863. // Shortcuts
  2864. var data = this._data;
  2865. var dataWords = data.words;
  2866. var nBitsTotal = this._nDataBytes * 8;
  2867. var nBitsLeft = data.sigBytes * 8;
  2868. // Add padding
  2869. dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
  2870. dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
  2871. (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |
  2872. (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)
  2873. );
  2874. data.sigBytes = (dataWords.length + 1) * 4;
  2875. // Hash final blocks
  2876. this._process();
  2877. // Shortcuts
  2878. var hash = this._hash;
  2879. var H = hash.words;
  2880. // Swap endian
  2881. for (var i = 0; i < 5; i++) {
  2882. // Shortcut
  2883. var H_i = H[i];
  2884. // Swap
  2885. H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
  2886. (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
  2887. }
  2888. // Return final computed hash
  2889. return hash;
  2890. },
  2891. clone: function () {
  2892. var clone = Hasher.clone.call(this);
  2893. clone._hash = this._hash.clone();
  2894. return clone;
  2895. }
  2896. });
  2897. function f1(x, y, z) {
  2898. return ((x) ^ (y) ^ (z));
  2899. }
  2900. function f2(x, y, z) {
  2901. return (((x)&(y)) | ((~x)&(z)));
  2902. }
  2903. function f3(x, y, z) {
  2904. return (((x) | (~(y))) ^ (z));
  2905. }
  2906. function f4(x, y, z) {
  2907. return (((x) & (z)) | ((y)&(~(z))));
  2908. }
  2909. function f5(x, y, z) {
  2910. return ((x) ^ ((y) |(~(z))));
  2911. }
  2912. function rotl(x,n) {
  2913. return (x<<n) | (x>>>(32-n));
  2914. }
  2915. /**
  2916. * Shortcut function to the hasher's object interface.
  2917. *
  2918. * @param {WordArray|string} message The message to hash.
  2919. *
  2920. * @return {WordArray} The hash.
  2921. *
  2922. * @static
  2923. *
  2924. * @example
  2925. *
  2926. * var hash = CryptoJS.RIPEMD160('message');
  2927. * var hash = CryptoJS.RIPEMD160(wordArray);
  2928. */
  2929. C.RIPEMD160 = Hasher._createHelper(RIPEMD160);
  2930. /**
  2931. * Shortcut function to the HMAC's object interface.
  2932. *
  2933. * @param {WordArray|string} message The message to hash.
  2934. * @param {WordArray|string} key The secret key.
  2935. *
  2936. * @return {WordArray} The HMAC.
  2937. *
  2938. * @static
  2939. *
  2940. * @example
  2941. *
  2942. * var hmac = CryptoJS.HmacRIPEMD160(message, key);
  2943. */
  2944. C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160);
  2945. }(Math));
  2946. return CryptoJS.RIPEMD160;
  2947. }));
  2948. }, function(modId) { var map = {"./core":1733984946567}; return __REQUIRE__(map[modId], modId); })
  2949. __DEFINE__(1733984946581, function(require, module, exports) {
  2950. ;(function (root, factory) {
  2951. if (typeof exports === "object") {
  2952. // CommonJS
  2953. module.exports = exports = factory(require("./core"));
  2954. }
  2955. else if (typeof define === "function" && define.amd) {
  2956. // AMD
  2957. define(["./core"], factory);
  2958. }
  2959. else {
  2960. // Global (browser)
  2961. factory(root.CryptoJS);
  2962. }
  2963. }(this, function (CryptoJS) {
  2964. (function () {
  2965. // Shortcuts
  2966. var C = CryptoJS;
  2967. var C_lib = C.lib;
  2968. var Base = C_lib.Base;
  2969. var C_enc = C.enc;
  2970. var Utf8 = C_enc.Utf8;
  2971. var C_algo = C.algo;
  2972. /**
  2973. * HMAC algorithm.
  2974. */
  2975. var HMAC = C_algo.HMAC = Base.extend({
  2976. /**
  2977. * Initializes a newly created HMAC.
  2978. *
  2979. * @param {Hasher} hasher The hash algorithm to use.
  2980. * @param {WordArray|string} key The secret key.
  2981. *
  2982. * @example
  2983. *
  2984. * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
  2985. */
  2986. init: function (hasher, key) {
  2987. // Init hasher
  2988. hasher = this._hasher = new hasher.init();
  2989. // Convert string to WordArray, else assume WordArray already
  2990. if (typeof key == 'string') {
  2991. key = Utf8.parse(key);
  2992. }
  2993. // Shortcuts
  2994. var hasherBlockSize = hasher.blockSize;
  2995. var hasherBlockSizeBytes = hasherBlockSize * 4;
  2996. // Allow arbitrary length keys
  2997. if (key.sigBytes > hasherBlockSizeBytes) {
  2998. key = hasher.finalize(key);
  2999. }
  3000. // Clamp excess bits
  3001. key.clamp();
  3002. // Clone key for inner and outer pads
  3003. var oKey = this._oKey = key.clone();
  3004. var iKey = this._iKey = key.clone();
  3005. // Shortcuts
  3006. var oKeyWords = oKey.words;
  3007. var iKeyWords = iKey.words;
  3008. // XOR keys with pad constants
  3009. for (var i = 0; i < hasherBlockSize; i++) {
  3010. oKeyWords[i] ^= 0x5c5c5c5c;
  3011. iKeyWords[i] ^= 0x36363636;
  3012. }
  3013. oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
  3014. // Set initial values
  3015. this.reset();
  3016. },
  3017. /**
  3018. * Resets this HMAC to its initial state.
  3019. *
  3020. * @example
  3021. *
  3022. * hmacHasher.reset();
  3023. */
  3024. reset: function () {
  3025. // Shortcut
  3026. var hasher = this._hasher;
  3027. // Reset
  3028. hasher.reset();
  3029. hasher.update(this._iKey);
  3030. },
  3031. /**
  3032. * Updates this HMAC with a message.
  3033. *
  3034. * @param {WordArray|string} messageUpdate The message to append.
  3035. *
  3036. * @return {HMAC} This HMAC instance.
  3037. *
  3038. * @example
  3039. *
  3040. * hmacHasher.update('message');
  3041. * hmacHasher.update(wordArray);
  3042. */
  3043. update: function (messageUpdate) {
  3044. this._hasher.update(messageUpdate);
  3045. // Chainable
  3046. return this;
  3047. },
  3048. /**
  3049. * Finalizes the HMAC computation.
  3050. * Note that the finalize operation is effectively a destructive, read-once operation.
  3051. *
  3052. * @param {WordArray|string} messageUpdate (Optional) A final message update.
  3053. *
  3054. * @return {WordArray} The HMAC.
  3055. *
  3056. * @example
  3057. *
  3058. * var hmac = hmacHasher.finalize();
  3059. * var hmac = hmacHasher.finalize('message');
  3060. * var hmac = hmacHasher.finalize(wordArray);
  3061. */
  3062. finalize: function (messageUpdate) {
  3063. // Shortcut
  3064. var hasher = this._hasher;
  3065. // Compute HMAC
  3066. var innerHash = hasher.finalize(messageUpdate);
  3067. hasher.reset();
  3068. var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
  3069. return hmac;
  3070. }
  3071. });
  3072. }());
  3073. }));
  3074. }, function(modId) { var map = {"./core":1733984946567}; return __REQUIRE__(map[modId], modId); })
  3075. __DEFINE__(1733984946582, function(require, module, exports) {
  3076. ;(function (root, factory, undef) {
  3077. if (typeof exports === "object") {
  3078. // CommonJS
  3079. module.exports = exports = factory(require("./core"), require("./sha256"), require("./hmac"));
  3080. }
  3081. else if (typeof define === "function" && define.amd) {
  3082. // AMD
  3083. define(["./core", "./sha256", "./hmac"], factory);
  3084. }
  3085. else {
  3086. // Global (browser)
  3087. factory(root.CryptoJS);
  3088. }
  3089. }(this, function (CryptoJS) {
  3090. (function () {
  3091. // Shortcuts
  3092. var C = CryptoJS;
  3093. var C_lib = C.lib;
  3094. var Base = C_lib.Base;
  3095. var WordArray = C_lib.WordArray;
  3096. var C_algo = C.algo;
  3097. var SHA256 = C_algo.SHA256;
  3098. var HMAC = C_algo.HMAC;
  3099. /**
  3100. * Password-Based Key Derivation Function 2 algorithm.
  3101. */
  3102. var PBKDF2 = C_algo.PBKDF2 = Base.extend({
  3103. /**
  3104. * Configuration options.
  3105. *
  3106. * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
  3107. * @property {Hasher} hasher The hasher to use. Default: SHA256
  3108. * @property {number} iterations The number of iterations to perform. Default: 250000
  3109. */
  3110. cfg: Base.extend({
  3111. keySize: 128/32,
  3112. hasher: SHA256,
  3113. iterations: 250000
  3114. }),
  3115. /**
  3116. * Initializes a newly created key derivation function.
  3117. *
  3118. * @param {Object} cfg (Optional) The configuration options to use for the derivation.
  3119. *
  3120. * @example
  3121. *
  3122. * var kdf = CryptoJS.algo.PBKDF2.create();
  3123. * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });
  3124. * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });
  3125. */
  3126. init: function (cfg) {
  3127. this.cfg = this.cfg.extend(cfg);
  3128. },
  3129. /**
  3130. * Computes the Password-Based Key Derivation Function 2.
  3131. *
  3132. * @param {WordArray|string} password The password.
  3133. * @param {WordArray|string} salt A salt.
  3134. *
  3135. * @return {WordArray} The derived key.
  3136. *
  3137. * @example
  3138. *
  3139. * var key = kdf.compute(password, salt);
  3140. */
  3141. compute: function (password, salt) {
  3142. // Shortcut
  3143. var cfg = this.cfg;
  3144. // Init HMAC
  3145. var hmac = HMAC.create(cfg.hasher, password);
  3146. // Initial values
  3147. var derivedKey = WordArray.create();
  3148. var blockIndex = WordArray.create([0x00000001]);
  3149. // Shortcuts
  3150. var derivedKeyWords = derivedKey.words;
  3151. var blockIndexWords = blockIndex.words;
  3152. var keySize = cfg.keySize;
  3153. var iterations = cfg.iterations;
  3154. // Generate key
  3155. while (derivedKeyWords.length < keySize) {
  3156. var block = hmac.update(salt).finalize(blockIndex);
  3157. hmac.reset();
  3158. // Shortcuts
  3159. var blockWords = block.words;
  3160. var blockWordsLength = blockWords.length;
  3161. // Iterations
  3162. var intermediate = block;
  3163. for (var i = 1; i < iterations; i++) {
  3164. intermediate = hmac.finalize(intermediate);
  3165. hmac.reset();
  3166. // Shortcut
  3167. var intermediateWords = intermediate.words;
  3168. // XOR intermediate with block
  3169. for (var j = 0; j < blockWordsLength; j++) {
  3170. blockWords[j] ^= intermediateWords[j];
  3171. }
  3172. }
  3173. derivedKey.concat(block);
  3174. blockIndexWords[0]++;
  3175. }
  3176. derivedKey.sigBytes = keySize * 4;
  3177. return derivedKey;
  3178. }
  3179. });
  3180. /**
  3181. * Computes the Password-Based Key Derivation Function 2.
  3182. *
  3183. * @param {WordArray|string} password The password.
  3184. * @param {WordArray|string} salt A salt.
  3185. * @param {Object} cfg (Optional) The configuration options to use for this computation.
  3186. *
  3187. * @return {WordArray} The derived key.
  3188. *
  3189. * @static
  3190. *
  3191. * @example
  3192. *
  3193. * var key = CryptoJS.PBKDF2(password, salt);
  3194. * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });
  3195. * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
  3196. */
  3197. C.PBKDF2 = function (password, salt, cfg) {
  3198. return PBKDF2.create(cfg).compute(password, salt);
  3199. };
  3200. }());
  3201. return CryptoJS.PBKDF2;
  3202. }));
  3203. }, function(modId) { var map = {"./core":1733984946567,"./sha256":1733984946575,"./hmac":1733984946581}; return __REQUIRE__(map[modId], modId); })
  3204. __DEFINE__(1733984946583, function(require, module, exports) {
  3205. ;(function (root, factory, undef) {
  3206. if (typeof exports === "object") {
  3207. // CommonJS
  3208. module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac"));
  3209. }
  3210. else if (typeof define === "function" && define.amd) {
  3211. // AMD
  3212. define(["./core", "./sha1", "./hmac"], factory);
  3213. }
  3214. else {
  3215. // Global (browser)
  3216. factory(root.CryptoJS);
  3217. }
  3218. }(this, function (CryptoJS) {
  3219. (function () {
  3220. // Shortcuts
  3221. var C = CryptoJS;
  3222. var C_lib = C.lib;
  3223. var Base = C_lib.Base;
  3224. var WordArray = C_lib.WordArray;
  3225. var C_algo = C.algo;
  3226. var MD5 = C_algo.MD5;
  3227. /**
  3228. * This key derivation function is meant to conform with EVP_BytesToKey.
  3229. * www.openssl.org/docs/crypto/EVP_BytesToKey.html
  3230. */
  3231. var EvpKDF = C_algo.EvpKDF = Base.extend({
  3232. /**
  3233. * Configuration options.
  3234. *
  3235. * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
  3236. * @property {Hasher} hasher The hash algorithm to use. Default: MD5
  3237. * @property {number} iterations The number of iterations to perform. Default: 1
  3238. */
  3239. cfg: Base.extend({
  3240. keySize: 128/32,
  3241. hasher: MD5,
  3242. iterations: 1
  3243. }),
  3244. /**
  3245. * Initializes a newly created key derivation function.
  3246. *
  3247. * @param {Object} cfg (Optional) The configuration options to use for the derivation.
  3248. *
  3249. * @example
  3250. *
  3251. * var kdf = CryptoJS.algo.EvpKDF.create();
  3252. * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
  3253. * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
  3254. */
  3255. init: function (cfg) {
  3256. this.cfg = this.cfg.extend(cfg);
  3257. },
  3258. /**
  3259. * Derives a key from a password.
  3260. *
  3261. * @param {WordArray|string} password The password.
  3262. * @param {WordArray|string} salt A salt.
  3263. *
  3264. * @return {WordArray} The derived key.
  3265. *
  3266. * @example
  3267. *
  3268. * var key = kdf.compute(password, salt);
  3269. */
  3270. compute: function (password, salt) {
  3271. var block;
  3272. // Shortcut
  3273. var cfg = this.cfg;
  3274. // Init hasher
  3275. var hasher = cfg.hasher.create();
  3276. // Initial values
  3277. var derivedKey = WordArray.create();
  3278. // Shortcuts
  3279. var derivedKeyWords = derivedKey.words;
  3280. var keySize = cfg.keySize;
  3281. var iterations = cfg.iterations;
  3282. // Generate key
  3283. while (derivedKeyWords.length < keySize) {
  3284. if (block) {
  3285. hasher.update(block);
  3286. }
  3287. block = hasher.update(password).finalize(salt);
  3288. hasher.reset();
  3289. // Iterations
  3290. for (var i = 1; i < iterations; i++) {
  3291. block = hasher.finalize(block);
  3292. hasher.reset();
  3293. }
  3294. derivedKey.concat(block);
  3295. }
  3296. derivedKey.sigBytes = keySize * 4;
  3297. return derivedKey;
  3298. }
  3299. });
  3300. /**
  3301. * Derives a key from a password.
  3302. *
  3303. * @param {WordArray|string} password The password.
  3304. * @param {WordArray|string} salt A salt.
  3305. * @param {Object} cfg (Optional) The configuration options to use for this computation.
  3306. *
  3307. * @return {WordArray} The derived key.
  3308. *
  3309. * @static
  3310. *
  3311. * @example
  3312. *
  3313. * var key = CryptoJS.EvpKDF(password, salt);
  3314. * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
  3315. * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
  3316. */
  3317. C.EvpKDF = function (password, salt, cfg) {
  3318. return EvpKDF.create(cfg).compute(password, salt);
  3319. };
  3320. }());
  3321. return CryptoJS.EvpKDF;
  3322. }));
  3323. }, function(modId) { var map = {"./core":1733984946567,"./sha1":1733984946574,"./hmac":1733984946581}; return __REQUIRE__(map[modId], modId); })
  3324. __DEFINE__(1733984946584, function(require, module, exports) {
  3325. ;(function (root, factory, undef) {
  3326. if (typeof exports === "object") {
  3327. // CommonJS
  3328. module.exports = exports = factory(require("./core"), require("./evpkdf"));
  3329. }
  3330. else if (typeof define === "function" && define.amd) {
  3331. // AMD
  3332. define(["./core", "./evpkdf"], factory);
  3333. }
  3334. else {
  3335. // Global (browser)
  3336. factory(root.CryptoJS);
  3337. }
  3338. }(this, function (CryptoJS) {
  3339. /**
  3340. * Cipher core components.
  3341. */
  3342. CryptoJS.lib.Cipher || (function (undefined) {
  3343. // Shortcuts
  3344. var C = CryptoJS;
  3345. var C_lib = C.lib;
  3346. var Base = C_lib.Base;
  3347. var WordArray = C_lib.WordArray;
  3348. var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
  3349. var C_enc = C.enc;
  3350. var Utf8 = C_enc.Utf8;
  3351. var Base64 = C_enc.Base64;
  3352. var C_algo = C.algo;
  3353. var EvpKDF = C_algo.EvpKDF;
  3354. /**
  3355. * Abstract base cipher template.
  3356. *
  3357. * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
  3358. * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
  3359. * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
  3360. * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
  3361. */
  3362. var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
  3363. /**
  3364. * Configuration options.
  3365. *
  3366. * @property {WordArray} iv The IV to use for this operation.
  3367. */
  3368. cfg: Base.extend(),
  3369. /**
  3370. * Creates this cipher in encryption mode.
  3371. *
  3372. * @param {WordArray} key The key.
  3373. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  3374. *
  3375. * @return {Cipher} A cipher instance.
  3376. *
  3377. * @static
  3378. *
  3379. * @example
  3380. *
  3381. * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
  3382. */
  3383. createEncryptor: function (key, cfg) {
  3384. return this.create(this._ENC_XFORM_MODE, key, cfg);
  3385. },
  3386. /**
  3387. * Creates this cipher in decryption mode.
  3388. *
  3389. * @param {WordArray} key The key.
  3390. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  3391. *
  3392. * @return {Cipher} A cipher instance.
  3393. *
  3394. * @static
  3395. *
  3396. * @example
  3397. *
  3398. * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
  3399. */
  3400. createDecryptor: function (key, cfg) {
  3401. return this.create(this._DEC_XFORM_MODE, key, cfg);
  3402. },
  3403. /**
  3404. * Initializes a newly created cipher.
  3405. *
  3406. * @param {number} xformMode Either the encryption or decryption transormation mode constant.
  3407. * @param {WordArray} key The key.
  3408. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  3409. *
  3410. * @example
  3411. *
  3412. * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
  3413. */
  3414. init: function (xformMode, key, cfg) {
  3415. // Apply config defaults
  3416. this.cfg = this.cfg.extend(cfg);
  3417. // Store transform mode and key
  3418. this._xformMode = xformMode;
  3419. this._key = key;
  3420. // Set initial values
  3421. this.reset();
  3422. },
  3423. /**
  3424. * Resets this cipher to its initial state.
  3425. *
  3426. * @example
  3427. *
  3428. * cipher.reset();
  3429. */
  3430. reset: function () {
  3431. // Reset data buffer
  3432. BufferedBlockAlgorithm.reset.call(this);
  3433. // Perform concrete-cipher logic
  3434. this._doReset();
  3435. },
  3436. /**
  3437. * Adds data to be encrypted or decrypted.
  3438. *
  3439. * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
  3440. *
  3441. * @return {WordArray} The data after processing.
  3442. *
  3443. * @example
  3444. *
  3445. * var encrypted = cipher.process('data');
  3446. * var encrypted = cipher.process(wordArray);
  3447. */
  3448. process: function (dataUpdate) {
  3449. // Append
  3450. this._append(dataUpdate);
  3451. // Process available blocks
  3452. return this._process();
  3453. },
  3454. /**
  3455. * Finalizes the encryption or decryption process.
  3456. * Note that the finalize operation is effectively a destructive, read-once operation.
  3457. *
  3458. * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
  3459. *
  3460. * @return {WordArray} The data after final processing.
  3461. *
  3462. * @example
  3463. *
  3464. * var encrypted = cipher.finalize();
  3465. * var encrypted = cipher.finalize('data');
  3466. * var encrypted = cipher.finalize(wordArray);
  3467. */
  3468. finalize: function (dataUpdate) {
  3469. // Final data update
  3470. if (dataUpdate) {
  3471. this._append(dataUpdate);
  3472. }
  3473. // Perform concrete-cipher logic
  3474. var finalProcessedData = this._doFinalize();
  3475. return finalProcessedData;
  3476. },
  3477. keySize: 128/32,
  3478. ivSize: 128/32,
  3479. _ENC_XFORM_MODE: 1,
  3480. _DEC_XFORM_MODE: 2,
  3481. /**
  3482. * Creates shortcut functions to a cipher's object interface.
  3483. *
  3484. * @param {Cipher} cipher The cipher to create a helper for.
  3485. *
  3486. * @return {Object} An object with encrypt and decrypt shortcut functions.
  3487. *
  3488. * @static
  3489. *
  3490. * @example
  3491. *
  3492. * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
  3493. */
  3494. _createHelper: (function () {
  3495. function selectCipherStrategy(key) {
  3496. if (typeof key == 'string') {
  3497. return PasswordBasedCipher;
  3498. } else {
  3499. return SerializableCipher;
  3500. }
  3501. }
  3502. return function (cipher) {
  3503. return {
  3504. encrypt: function (message, key, cfg) {
  3505. return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
  3506. },
  3507. decrypt: function (ciphertext, key, cfg) {
  3508. return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
  3509. }
  3510. };
  3511. };
  3512. }())
  3513. });
  3514. /**
  3515. * Abstract base stream cipher template.
  3516. *
  3517. * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
  3518. */
  3519. var StreamCipher = C_lib.StreamCipher = Cipher.extend({
  3520. _doFinalize: function () {
  3521. // Process partial blocks
  3522. var finalProcessedBlocks = this._process(!!'flush');
  3523. return finalProcessedBlocks;
  3524. },
  3525. blockSize: 1
  3526. });
  3527. /**
  3528. * Mode namespace.
  3529. */
  3530. var C_mode = C.mode = {};
  3531. /**
  3532. * Abstract base block cipher mode template.
  3533. */
  3534. var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
  3535. /**
  3536. * Creates this mode for encryption.
  3537. *
  3538. * @param {Cipher} cipher A block cipher instance.
  3539. * @param {Array} iv The IV words.
  3540. *
  3541. * @static
  3542. *
  3543. * @example
  3544. *
  3545. * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
  3546. */
  3547. createEncryptor: function (cipher, iv) {
  3548. return this.Encryptor.create(cipher, iv);
  3549. },
  3550. /**
  3551. * Creates this mode for decryption.
  3552. *
  3553. * @param {Cipher} cipher A block cipher instance.
  3554. * @param {Array} iv The IV words.
  3555. *
  3556. * @static
  3557. *
  3558. * @example
  3559. *
  3560. * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
  3561. */
  3562. createDecryptor: function (cipher, iv) {
  3563. return this.Decryptor.create(cipher, iv);
  3564. },
  3565. /**
  3566. * Initializes a newly created mode.
  3567. *
  3568. * @param {Cipher} cipher A block cipher instance.
  3569. * @param {Array} iv The IV words.
  3570. *
  3571. * @example
  3572. *
  3573. * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
  3574. */
  3575. init: function (cipher, iv) {
  3576. this._cipher = cipher;
  3577. this._iv = iv;
  3578. }
  3579. });
  3580. /**
  3581. * Cipher Block Chaining mode.
  3582. */
  3583. var CBC = C_mode.CBC = (function () {
  3584. /**
  3585. * Abstract base CBC mode.
  3586. */
  3587. var CBC = BlockCipherMode.extend();
  3588. /**
  3589. * CBC encryptor.
  3590. */
  3591. CBC.Encryptor = CBC.extend({
  3592. /**
  3593. * Processes the data block at offset.
  3594. *
  3595. * @param {Array} words The data words to operate on.
  3596. * @param {number} offset The offset where the block starts.
  3597. *
  3598. * @example
  3599. *
  3600. * mode.processBlock(data.words, offset);
  3601. */
  3602. processBlock: function (words, offset) {
  3603. // Shortcuts
  3604. var cipher = this._cipher;
  3605. var blockSize = cipher.blockSize;
  3606. // XOR and encrypt
  3607. xorBlock.call(this, words, offset, blockSize);
  3608. cipher.encryptBlock(words, offset);
  3609. // Remember this block to use with next block
  3610. this._prevBlock = words.slice(offset, offset + blockSize);
  3611. }
  3612. });
  3613. /**
  3614. * CBC decryptor.
  3615. */
  3616. CBC.Decryptor = CBC.extend({
  3617. /**
  3618. * Processes the data block at offset.
  3619. *
  3620. * @param {Array} words The data words to operate on.
  3621. * @param {number} offset The offset where the block starts.
  3622. *
  3623. * @example
  3624. *
  3625. * mode.processBlock(data.words, offset);
  3626. */
  3627. processBlock: function (words, offset) {
  3628. // Shortcuts
  3629. var cipher = this._cipher;
  3630. var blockSize = cipher.blockSize;
  3631. // Remember this block to use with next block
  3632. var thisBlock = words.slice(offset, offset + blockSize);
  3633. // Decrypt and XOR
  3634. cipher.decryptBlock(words, offset);
  3635. xorBlock.call(this, words, offset, blockSize);
  3636. // This block becomes the previous block
  3637. this._prevBlock = thisBlock;
  3638. }
  3639. });
  3640. function xorBlock(words, offset, blockSize) {
  3641. var block;
  3642. // Shortcut
  3643. var iv = this._iv;
  3644. // Choose mixing block
  3645. if (iv) {
  3646. block = iv;
  3647. // Remove IV for subsequent blocks
  3648. this._iv = undefined;
  3649. } else {
  3650. block = this._prevBlock;
  3651. }
  3652. // XOR blocks
  3653. for (var i = 0; i < blockSize; i++) {
  3654. words[offset + i] ^= block[i];
  3655. }
  3656. }
  3657. return CBC;
  3658. }());
  3659. /**
  3660. * Padding namespace.
  3661. */
  3662. var C_pad = C.pad = {};
  3663. /**
  3664. * PKCS #5/7 padding strategy.
  3665. */
  3666. var Pkcs7 = C_pad.Pkcs7 = {
  3667. /**
  3668. * Pads data using the algorithm defined in PKCS #5/7.
  3669. *
  3670. * @param {WordArray} data The data to pad.
  3671. * @param {number} blockSize The multiple that the data should be padded to.
  3672. *
  3673. * @static
  3674. *
  3675. * @example
  3676. *
  3677. * CryptoJS.pad.Pkcs7.pad(wordArray, 4);
  3678. */
  3679. pad: function (data, blockSize) {
  3680. // Shortcut
  3681. var blockSizeBytes = blockSize * 4;
  3682. // Count padding bytes
  3683. var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
  3684. // Create padding word
  3685. var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;
  3686. // Create padding
  3687. var paddingWords = [];
  3688. for (var i = 0; i < nPaddingBytes; i += 4) {
  3689. paddingWords.push(paddingWord);
  3690. }
  3691. var padding = WordArray.create(paddingWords, nPaddingBytes);
  3692. // Add padding
  3693. data.concat(padding);
  3694. },
  3695. /**
  3696. * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
  3697. *
  3698. * @param {WordArray} data The data to unpad.
  3699. *
  3700. * @static
  3701. *
  3702. * @example
  3703. *
  3704. * CryptoJS.pad.Pkcs7.unpad(wordArray);
  3705. */
  3706. unpad: function (data) {
  3707. // Get number of padding bytes from last byte
  3708. var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
  3709. // Remove padding
  3710. data.sigBytes -= nPaddingBytes;
  3711. }
  3712. };
  3713. /**
  3714. * Abstract base block cipher template.
  3715. *
  3716. * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
  3717. */
  3718. var BlockCipher = C_lib.BlockCipher = Cipher.extend({
  3719. /**
  3720. * Configuration options.
  3721. *
  3722. * @property {Mode} mode The block mode to use. Default: CBC
  3723. * @property {Padding} padding The padding strategy to use. Default: Pkcs7
  3724. */
  3725. cfg: Cipher.cfg.extend({
  3726. mode: CBC,
  3727. padding: Pkcs7
  3728. }),
  3729. reset: function () {
  3730. var modeCreator;
  3731. // Reset cipher
  3732. Cipher.reset.call(this);
  3733. // Shortcuts
  3734. var cfg = this.cfg;
  3735. var iv = cfg.iv;
  3736. var mode = cfg.mode;
  3737. // Reset block mode
  3738. if (this._xformMode == this._ENC_XFORM_MODE) {
  3739. modeCreator = mode.createEncryptor;
  3740. } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
  3741. modeCreator = mode.createDecryptor;
  3742. // Keep at least one block in the buffer for unpadding
  3743. this._minBufferSize = 1;
  3744. }
  3745. if (this._mode && this._mode.__creator == modeCreator) {
  3746. this._mode.init(this, iv && iv.words);
  3747. } else {
  3748. this._mode = modeCreator.call(mode, this, iv && iv.words);
  3749. this._mode.__creator = modeCreator;
  3750. }
  3751. },
  3752. _doProcessBlock: function (words, offset) {
  3753. this._mode.processBlock(words, offset);
  3754. },
  3755. _doFinalize: function () {
  3756. var finalProcessedBlocks;
  3757. // Shortcut
  3758. var padding = this.cfg.padding;
  3759. // Finalize
  3760. if (this._xformMode == this._ENC_XFORM_MODE) {
  3761. // Pad data
  3762. padding.pad(this._data, this.blockSize);
  3763. // Process final blocks
  3764. finalProcessedBlocks = this._process(!!'flush');
  3765. } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
  3766. // Process final blocks
  3767. finalProcessedBlocks = this._process(!!'flush');
  3768. // Unpad data
  3769. padding.unpad(finalProcessedBlocks);
  3770. }
  3771. return finalProcessedBlocks;
  3772. },
  3773. blockSize: 128/32
  3774. });
  3775. /**
  3776. * A collection of cipher parameters.
  3777. *
  3778. * @property {WordArray} ciphertext The raw ciphertext.
  3779. * @property {WordArray} key The key to this ciphertext.
  3780. * @property {WordArray} iv The IV used in the ciphering operation.
  3781. * @property {WordArray} salt The salt used with a key derivation function.
  3782. * @property {Cipher} algorithm The cipher algorithm.
  3783. * @property {Mode} mode The block mode used in the ciphering operation.
  3784. * @property {Padding} padding The padding scheme used in the ciphering operation.
  3785. * @property {number} blockSize The block size of the cipher.
  3786. * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
  3787. */
  3788. var CipherParams = C_lib.CipherParams = Base.extend({
  3789. /**
  3790. * Initializes a newly created cipher params object.
  3791. *
  3792. * @param {Object} cipherParams An object with any of the possible cipher parameters.
  3793. *
  3794. * @example
  3795. *
  3796. * var cipherParams = CryptoJS.lib.CipherParams.create({
  3797. * ciphertext: ciphertextWordArray,
  3798. * key: keyWordArray,
  3799. * iv: ivWordArray,
  3800. * salt: saltWordArray,
  3801. * algorithm: CryptoJS.algo.AES,
  3802. * mode: CryptoJS.mode.CBC,
  3803. * padding: CryptoJS.pad.PKCS7,
  3804. * blockSize: 4,
  3805. * formatter: CryptoJS.format.OpenSSL
  3806. * });
  3807. */
  3808. init: function (cipherParams) {
  3809. this.mixIn(cipherParams);
  3810. },
  3811. /**
  3812. * Converts this cipher params object to a string.
  3813. *
  3814. * @param {Format} formatter (Optional) The formatting strategy to use.
  3815. *
  3816. * @return {string} The stringified cipher params.
  3817. *
  3818. * @throws Error If neither the formatter nor the default formatter is set.
  3819. *
  3820. * @example
  3821. *
  3822. * var string = cipherParams + '';
  3823. * var string = cipherParams.toString();
  3824. * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
  3825. */
  3826. toString: function (formatter) {
  3827. return (formatter || this.formatter).stringify(this);
  3828. }
  3829. });
  3830. /**
  3831. * Format namespace.
  3832. */
  3833. var C_format = C.format = {};
  3834. /**
  3835. * OpenSSL formatting strategy.
  3836. */
  3837. var OpenSSLFormatter = C_format.OpenSSL = {
  3838. /**
  3839. * Converts a cipher params object to an OpenSSL-compatible string.
  3840. *
  3841. * @param {CipherParams} cipherParams The cipher params object.
  3842. *
  3843. * @return {string} The OpenSSL-compatible string.
  3844. *
  3845. * @static
  3846. *
  3847. * @example
  3848. *
  3849. * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
  3850. */
  3851. stringify: function (cipherParams) {
  3852. var wordArray;
  3853. // Shortcuts
  3854. var ciphertext = cipherParams.ciphertext;
  3855. var salt = cipherParams.salt;
  3856. // Format
  3857. if (salt) {
  3858. wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
  3859. } else {
  3860. wordArray = ciphertext;
  3861. }
  3862. return wordArray.toString(Base64);
  3863. },
  3864. /**
  3865. * Converts an OpenSSL-compatible string to a cipher params object.
  3866. *
  3867. * @param {string} openSSLStr The OpenSSL-compatible string.
  3868. *
  3869. * @return {CipherParams} The cipher params object.
  3870. *
  3871. * @static
  3872. *
  3873. * @example
  3874. *
  3875. * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
  3876. */
  3877. parse: function (openSSLStr) {
  3878. var salt;
  3879. // Parse base64
  3880. var ciphertext = Base64.parse(openSSLStr);
  3881. // Shortcut
  3882. var ciphertextWords = ciphertext.words;
  3883. // Test for salt
  3884. if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
  3885. // Extract salt
  3886. salt = WordArray.create(ciphertextWords.slice(2, 4));
  3887. // Remove salt from ciphertext
  3888. ciphertextWords.splice(0, 4);
  3889. ciphertext.sigBytes -= 16;
  3890. }
  3891. return CipherParams.create({ ciphertext: ciphertext, salt: salt });
  3892. }
  3893. };
  3894. /**
  3895. * A cipher wrapper that returns ciphertext as a serializable cipher params object.
  3896. */
  3897. var SerializableCipher = C_lib.SerializableCipher = Base.extend({
  3898. /**
  3899. * Configuration options.
  3900. *
  3901. * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
  3902. */
  3903. cfg: Base.extend({
  3904. format: OpenSSLFormatter
  3905. }),
  3906. /**
  3907. * Encrypts a message.
  3908. *
  3909. * @param {Cipher} cipher The cipher algorithm to use.
  3910. * @param {WordArray|string} message The message to encrypt.
  3911. * @param {WordArray} key The key.
  3912. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  3913. *
  3914. * @return {CipherParams} A cipher params object.
  3915. *
  3916. * @static
  3917. *
  3918. * @example
  3919. *
  3920. * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
  3921. * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
  3922. * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  3923. */
  3924. encrypt: function (cipher, message, key, cfg) {
  3925. // Apply config defaults
  3926. cfg = this.cfg.extend(cfg);
  3927. // Encrypt
  3928. var encryptor = cipher.createEncryptor(key, cfg);
  3929. var ciphertext = encryptor.finalize(message);
  3930. // Shortcut
  3931. var cipherCfg = encryptor.cfg;
  3932. // Create and return serializable cipher params
  3933. return CipherParams.create({
  3934. ciphertext: ciphertext,
  3935. key: key,
  3936. iv: cipherCfg.iv,
  3937. algorithm: cipher,
  3938. mode: cipherCfg.mode,
  3939. padding: cipherCfg.padding,
  3940. blockSize: cipher.blockSize,
  3941. formatter: cfg.format
  3942. });
  3943. },
  3944. /**
  3945. * Decrypts serialized ciphertext.
  3946. *
  3947. * @param {Cipher} cipher The cipher algorithm to use.
  3948. * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
  3949. * @param {WordArray} key The key.
  3950. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  3951. *
  3952. * @return {WordArray} The plaintext.
  3953. *
  3954. * @static
  3955. *
  3956. * @example
  3957. *
  3958. * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  3959. * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  3960. */
  3961. decrypt: function (cipher, ciphertext, key, cfg) {
  3962. // Apply config defaults
  3963. cfg = this.cfg.extend(cfg);
  3964. // Convert string to CipherParams
  3965. ciphertext = this._parse(ciphertext, cfg.format);
  3966. // Decrypt
  3967. var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
  3968. return plaintext;
  3969. },
  3970. /**
  3971. * Converts serialized ciphertext to CipherParams,
  3972. * else assumed CipherParams already and returns ciphertext unchanged.
  3973. *
  3974. * @param {CipherParams|string} ciphertext The ciphertext.
  3975. * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
  3976. *
  3977. * @return {CipherParams} The unserialized ciphertext.
  3978. *
  3979. * @static
  3980. *
  3981. * @example
  3982. *
  3983. * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
  3984. */
  3985. _parse: function (ciphertext, format) {
  3986. if (typeof ciphertext == 'string') {
  3987. return format.parse(ciphertext, this);
  3988. } else {
  3989. return ciphertext;
  3990. }
  3991. }
  3992. });
  3993. /**
  3994. * Key derivation function namespace.
  3995. */
  3996. var C_kdf = C.kdf = {};
  3997. /**
  3998. * OpenSSL key derivation function.
  3999. */
  4000. var OpenSSLKdf = C_kdf.OpenSSL = {
  4001. /**
  4002. * Derives a key and IV from a password.
  4003. *
  4004. * @param {string} password The password to derive from.
  4005. * @param {number} keySize The size in words of the key to generate.
  4006. * @param {number} ivSize The size in words of the IV to generate.
  4007. * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
  4008. *
  4009. * @return {CipherParams} A cipher params object with the key, IV, and salt.
  4010. *
  4011. * @static
  4012. *
  4013. * @example
  4014. *
  4015. * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
  4016. * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
  4017. */
  4018. execute: function (password, keySize, ivSize, salt, hasher) {
  4019. // Generate random salt
  4020. if (!salt) {
  4021. salt = WordArray.random(64/8);
  4022. }
  4023. // Derive key and IV
  4024. if (!hasher) {
  4025. var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
  4026. } else {
  4027. var key = EvpKDF.create({ keySize: keySize + ivSize, hasher: hasher }).compute(password, salt);
  4028. }
  4029. // Separate key and IV
  4030. var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
  4031. key.sigBytes = keySize * 4;
  4032. // Return params
  4033. return CipherParams.create({ key: key, iv: iv, salt: salt });
  4034. }
  4035. };
  4036. /**
  4037. * A serializable cipher wrapper that derives the key from a password,
  4038. * and returns ciphertext as a serializable cipher params object.
  4039. */
  4040. var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
  4041. /**
  4042. * Configuration options.
  4043. *
  4044. * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
  4045. */
  4046. cfg: SerializableCipher.cfg.extend({
  4047. kdf: OpenSSLKdf
  4048. }),
  4049. /**
  4050. * Encrypts a message using a password.
  4051. *
  4052. * @param {Cipher} cipher The cipher algorithm to use.
  4053. * @param {WordArray|string} message The message to encrypt.
  4054. * @param {string} password The password.
  4055. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  4056. *
  4057. * @return {CipherParams} A cipher params object.
  4058. *
  4059. * @static
  4060. *
  4061. * @example
  4062. *
  4063. * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
  4064. * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
  4065. */
  4066. encrypt: function (cipher, message, password, cfg) {
  4067. // Apply config defaults
  4068. cfg = this.cfg.extend(cfg);
  4069. // Derive key and other params
  4070. var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, cfg.salt, cfg.hasher);
  4071. // Add IV to config
  4072. cfg.iv = derivedParams.iv;
  4073. // Encrypt
  4074. var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
  4075. // Mix in derived params
  4076. ciphertext.mixIn(derivedParams);
  4077. return ciphertext;
  4078. },
  4079. /**
  4080. * Decrypts serialized ciphertext using a password.
  4081. *
  4082. * @param {Cipher} cipher The cipher algorithm to use.
  4083. * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
  4084. * @param {string} password The password.
  4085. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  4086. *
  4087. * @return {WordArray} The plaintext.
  4088. *
  4089. * @static
  4090. *
  4091. * @example
  4092. *
  4093. * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
  4094. * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
  4095. */
  4096. decrypt: function (cipher, ciphertext, password, cfg) {
  4097. // Apply config defaults
  4098. cfg = this.cfg.extend(cfg);
  4099. // Convert string to CipherParams
  4100. ciphertext = this._parse(ciphertext, cfg.format);
  4101. // Derive key and other params
  4102. var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt, cfg.hasher);
  4103. // Add IV to config
  4104. cfg.iv = derivedParams.iv;
  4105. // Decrypt
  4106. var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
  4107. return plaintext;
  4108. }
  4109. });
  4110. }());
  4111. }));
  4112. }, function(modId) { var map = {"./core":1733984946567,"./evpkdf":1733984946583}; return __REQUIRE__(map[modId], modId); })
  4113. __DEFINE__(1733984946585, function(require, module, exports) {
  4114. ;(function (root, factory, undef) {
  4115. if (typeof exports === "object") {
  4116. // CommonJS
  4117. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4118. }
  4119. else if (typeof define === "function" && define.amd) {
  4120. // AMD
  4121. define(["./core", "./cipher-core"], factory);
  4122. }
  4123. else {
  4124. // Global (browser)
  4125. factory(root.CryptoJS);
  4126. }
  4127. }(this, function (CryptoJS) {
  4128. /**
  4129. * Cipher Feedback block mode.
  4130. */
  4131. CryptoJS.mode.CFB = (function () {
  4132. var CFB = CryptoJS.lib.BlockCipherMode.extend();
  4133. CFB.Encryptor = CFB.extend({
  4134. processBlock: function (words, offset) {
  4135. // Shortcuts
  4136. var cipher = this._cipher;
  4137. var blockSize = cipher.blockSize;
  4138. generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
  4139. // Remember this block to use with next block
  4140. this._prevBlock = words.slice(offset, offset + blockSize);
  4141. }
  4142. });
  4143. CFB.Decryptor = CFB.extend({
  4144. processBlock: function (words, offset) {
  4145. // Shortcuts
  4146. var cipher = this._cipher;
  4147. var blockSize = cipher.blockSize;
  4148. // Remember this block to use with next block
  4149. var thisBlock = words.slice(offset, offset + blockSize);
  4150. generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
  4151. // This block becomes the previous block
  4152. this._prevBlock = thisBlock;
  4153. }
  4154. });
  4155. function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) {
  4156. var keystream;
  4157. // Shortcut
  4158. var iv = this._iv;
  4159. // Generate keystream
  4160. if (iv) {
  4161. keystream = iv.slice(0);
  4162. // Remove IV for subsequent blocks
  4163. this._iv = undefined;
  4164. } else {
  4165. keystream = this._prevBlock;
  4166. }
  4167. cipher.encryptBlock(keystream, 0);
  4168. // Encrypt
  4169. for (var i = 0; i < blockSize; i++) {
  4170. words[offset + i] ^= keystream[i];
  4171. }
  4172. }
  4173. return CFB;
  4174. }());
  4175. return CryptoJS.mode.CFB;
  4176. }));
  4177. }, function(modId) { var map = {"./core":1733984946567,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  4178. __DEFINE__(1733984946586, function(require, module, exports) {
  4179. ;(function (root, factory, undef) {
  4180. if (typeof exports === "object") {
  4181. // CommonJS
  4182. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4183. }
  4184. else if (typeof define === "function" && define.amd) {
  4185. // AMD
  4186. define(["./core", "./cipher-core"], factory);
  4187. }
  4188. else {
  4189. // Global (browser)
  4190. factory(root.CryptoJS);
  4191. }
  4192. }(this, function (CryptoJS) {
  4193. /**
  4194. * Counter block mode.
  4195. */
  4196. CryptoJS.mode.CTR = (function () {
  4197. var CTR = CryptoJS.lib.BlockCipherMode.extend();
  4198. var Encryptor = CTR.Encryptor = CTR.extend({
  4199. processBlock: function (words, offset) {
  4200. // Shortcuts
  4201. var cipher = this._cipher
  4202. var blockSize = cipher.blockSize;
  4203. var iv = this._iv;
  4204. var counter = this._counter;
  4205. // Generate keystream
  4206. if (iv) {
  4207. counter = this._counter = iv.slice(0);
  4208. // Remove IV for subsequent blocks
  4209. this._iv = undefined;
  4210. }
  4211. var keystream = counter.slice(0);
  4212. cipher.encryptBlock(keystream, 0);
  4213. // Increment counter
  4214. counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0
  4215. // Encrypt
  4216. for (var i = 0; i < blockSize; i++) {
  4217. words[offset + i] ^= keystream[i];
  4218. }
  4219. }
  4220. });
  4221. CTR.Decryptor = Encryptor;
  4222. return CTR;
  4223. }());
  4224. return CryptoJS.mode.CTR;
  4225. }));
  4226. }, function(modId) { var map = {"./core":1733984946567,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  4227. __DEFINE__(1733984946587, function(require, module, exports) {
  4228. ;(function (root, factory, undef) {
  4229. if (typeof exports === "object") {
  4230. // CommonJS
  4231. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4232. }
  4233. else if (typeof define === "function" && define.amd) {
  4234. // AMD
  4235. define(["./core", "./cipher-core"], factory);
  4236. }
  4237. else {
  4238. // Global (browser)
  4239. factory(root.CryptoJS);
  4240. }
  4241. }(this, function (CryptoJS) {
  4242. /** @preserve
  4243. * Counter block mode compatible with Dr Brian Gladman fileenc.c
  4244. * derived from CryptoJS.mode.CTR
  4245. * Jan Hruby jhruby.web@gmail.com
  4246. */
  4247. CryptoJS.mode.CTRGladman = (function () {
  4248. var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();
  4249. function incWord(word)
  4250. {
  4251. if (((word >> 24) & 0xff) === 0xff) { //overflow
  4252. var b1 = (word >> 16)&0xff;
  4253. var b2 = (word >> 8)&0xff;
  4254. var b3 = word & 0xff;
  4255. if (b1 === 0xff) // overflow b1
  4256. {
  4257. b1 = 0;
  4258. if (b2 === 0xff)
  4259. {
  4260. b2 = 0;
  4261. if (b3 === 0xff)
  4262. {
  4263. b3 = 0;
  4264. }
  4265. else
  4266. {
  4267. ++b3;
  4268. }
  4269. }
  4270. else
  4271. {
  4272. ++b2;
  4273. }
  4274. }
  4275. else
  4276. {
  4277. ++b1;
  4278. }
  4279. word = 0;
  4280. word += (b1 << 16);
  4281. word += (b2 << 8);
  4282. word += b3;
  4283. }
  4284. else
  4285. {
  4286. word += (0x01 << 24);
  4287. }
  4288. return word;
  4289. }
  4290. function incCounter(counter)
  4291. {
  4292. if ((counter[0] = incWord(counter[0])) === 0)
  4293. {
  4294. // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8
  4295. counter[1] = incWord(counter[1]);
  4296. }
  4297. return counter;
  4298. }
  4299. var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({
  4300. processBlock: function (words, offset) {
  4301. // Shortcuts
  4302. var cipher = this._cipher
  4303. var blockSize = cipher.blockSize;
  4304. var iv = this._iv;
  4305. var counter = this._counter;
  4306. // Generate keystream
  4307. if (iv) {
  4308. counter = this._counter = iv.slice(0);
  4309. // Remove IV for subsequent blocks
  4310. this._iv = undefined;
  4311. }
  4312. incCounter(counter);
  4313. var keystream = counter.slice(0);
  4314. cipher.encryptBlock(keystream, 0);
  4315. // Encrypt
  4316. for (var i = 0; i < blockSize; i++) {
  4317. words[offset + i] ^= keystream[i];
  4318. }
  4319. }
  4320. });
  4321. CTRGladman.Decryptor = Encryptor;
  4322. return CTRGladman;
  4323. }());
  4324. return CryptoJS.mode.CTRGladman;
  4325. }));
  4326. }, function(modId) { var map = {"./core":1733984946567,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  4327. __DEFINE__(1733984946588, function(require, module, exports) {
  4328. ;(function (root, factory, undef) {
  4329. if (typeof exports === "object") {
  4330. // CommonJS
  4331. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4332. }
  4333. else if (typeof define === "function" && define.amd) {
  4334. // AMD
  4335. define(["./core", "./cipher-core"], factory);
  4336. }
  4337. else {
  4338. // Global (browser)
  4339. factory(root.CryptoJS);
  4340. }
  4341. }(this, function (CryptoJS) {
  4342. /**
  4343. * Output Feedback block mode.
  4344. */
  4345. CryptoJS.mode.OFB = (function () {
  4346. var OFB = CryptoJS.lib.BlockCipherMode.extend();
  4347. var Encryptor = OFB.Encryptor = OFB.extend({
  4348. processBlock: function (words, offset) {
  4349. // Shortcuts
  4350. var cipher = this._cipher
  4351. var blockSize = cipher.blockSize;
  4352. var iv = this._iv;
  4353. var keystream = this._keystream;
  4354. // Generate keystream
  4355. if (iv) {
  4356. keystream = this._keystream = iv.slice(0);
  4357. // Remove IV for subsequent blocks
  4358. this._iv = undefined;
  4359. }
  4360. cipher.encryptBlock(keystream, 0);
  4361. // Encrypt
  4362. for (var i = 0; i < blockSize; i++) {
  4363. words[offset + i] ^= keystream[i];
  4364. }
  4365. }
  4366. });
  4367. OFB.Decryptor = Encryptor;
  4368. return OFB;
  4369. }());
  4370. return CryptoJS.mode.OFB;
  4371. }));
  4372. }, function(modId) { var map = {"./core":1733984946567,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  4373. __DEFINE__(1733984946589, function(require, module, exports) {
  4374. ;(function (root, factory, undef) {
  4375. if (typeof exports === "object") {
  4376. // CommonJS
  4377. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4378. }
  4379. else if (typeof define === "function" && define.amd) {
  4380. // AMD
  4381. define(["./core", "./cipher-core"], factory);
  4382. }
  4383. else {
  4384. // Global (browser)
  4385. factory(root.CryptoJS);
  4386. }
  4387. }(this, function (CryptoJS) {
  4388. /**
  4389. * Electronic Codebook block mode.
  4390. */
  4391. CryptoJS.mode.ECB = (function () {
  4392. var ECB = CryptoJS.lib.BlockCipherMode.extend();
  4393. ECB.Encryptor = ECB.extend({
  4394. processBlock: function (words, offset) {
  4395. this._cipher.encryptBlock(words, offset);
  4396. }
  4397. });
  4398. ECB.Decryptor = ECB.extend({
  4399. processBlock: function (words, offset) {
  4400. this._cipher.decryptBlock(words, offset);
  4401. }
  4402. });
  4403. return ECB;
  4404. }());
  4405. return CryptoJS.mode.ECB;
  4406. }));
  4407. }, function(modId) { var map = {"./core":1733984946567,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  4408. __DEFINE__(1733984946590, function(require, module, exports) {
  4409. ;(function (root, factory, undef) {
  4410. if (typeof exports === "object") {
  4411. // CommonJS
  4412. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4413. }
  4414. else if (typeof define === "function" && define.amd) {
  4415. // AMD
  4416. define(["./core", "./cipher-core"], factory);
  4417. }
  4418. else {
  4419. // Global (browser)
  4420. factory(root.CryptoJS);
  4421. }
  4422. }(this, function (CryptoJS) {
  4423. /**
  4424. * ANSI X.923 padding strategy.
  4425. */
  4426. CryptoJS.pad.AnsiX923 = {
  4427. pad: function (data, blockSize) {
  4428. // Shortcuts
  4429. var dataSigBytes = data.sigBytes;
  4430. var blockSizeBytes = blockSize * 4;
  4431. // Count padding bytes
  4432. var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes;
  4433. // Compute last byte position
  4434. var lastBytePos = dataSigBytes + nPaddingBytes - 1;
  4435. // Pad
  4436. data.clamp();
  4437. data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8);
  4438. data.sigBytes += nPaddingBytes;
  4439. },
  4440. unpad: function (data) {
  4441. // Get number of padding bytes from last byte
  4442. var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
  4443. // Remove padding
  4444. data.sigBytes -= nPaddingBytes;
  4445. }
  4446. };
  4447. return CryptoJS.pad.Ansix923;
  4448. }));
  4449. }, function(modId) { var map = {"./core":1733984946567,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  4450. __DEFINE__(1733984946591, function(require, module, exports) {
  4451. ;(function (root, factory, undef) {
  4452. if (typeof exports === "object") {
  4453. // CommonJS
  4454. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4455. }
  4456. else if (typeof define === "function" && define.amd) {
  4457. // AMD
  4458. define(["./core", "./cipher-core"], factory);
  4459. }
  4460. else {
  4461. // Global (browser)
  4462. factory(root.CryptoJS);
  4463. }
  4464. }(this, function (CryptoJS) {
  4465. /**
  4466. * ISO 10126 padding strategy.
  4467. */
  4468. CryptoJS.pad.Iso10126 = {
  4469. pad: function (data, blockSize) {
  4470. // Shortcut
  4471. var blockSizeBytes = blockSize * 4;
  4472. // Count padding bytes
  4473. var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
  4474. // Pad
  4475. data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)).
  4476. concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1));
  4477. },
  4478. unpad: function (data) {
  4479. // Get number of padding bytes from last byte
  4480. var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
  4481. // Remove padding
  4482. data.sigBytes -= nPaddingBytes;
  4483. }
  4484. };
  4485. return CryptoJS.pad.Iso10126;
  4486. }));
  4487. }, function(modId) { var map = {"./core":1733984946567,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  4488. __DEFINE__(1733984946592, function(require, module, exports) {
  4489. ;(function (root, factory, undef) {
  4490. if (typeof exports === "object") {
  4491. // CommonJS
  4492. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4493. }
  4494. else if (typeof define === "function" && define.amd) {
  4495. // AMD
  4496. define(["./core", "./cipher-core"], factory);
  4497. }
  4498. else {
  4499. // Global (browser)
  4500. factory(root.CryptoJS);
  4501. }
  4502. }(this, function (CryptoJS) {
  4503. /**
  4504. * ISO/IEC 9797-1 Padding Method 2.
  4505. */
  4506. CryptoJS.pad.Iso97971 = {
  4507. pad: function (data, blockSize) {
  4508. // Add 0x80 byte
  4509. data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));
  4510. // Zero pad the rest
  4511. CryptoJS.pad.ZeroPadding.pad(data, blockSize);
  4512. },
  4513. unpad: function (data) {
  4514. // Remove zero padding
  4515. CryptoJS.pad.ZeroPadding.unpad(data);
  4516. // Remove one more byte -- the 0x80 byte
  4517. data.sigBytes--;
  4518. }
  4519. };
  4520. return CryptoJS.pad.Iso97971;
  4521. }));
  4522. }, function(modId) { var map = {"./core":1733984946567,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  4523. __DEFINE__(1733984946593, function(require, module, exports) {
  4524. ;(function (root, factory, undef) {
  4525. if (typeof exports === "object") {
  4526. // CommonJS
  4527. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4528. }
  4529. else if (typeof define === "function" && define.amd) {
  4530. // AMD
  4531. define(["./core", "./cipher-core"], factory);
  4532. }
  4533. else {
  4534. // Global (browser)
  4535. factory(root.CryptoJS);
  4536. }
  4537. }(this, function (CryptoJS) {
  4538. /**
  4539. * Zero padding strategy.
  4540. */
  4541. CryptoJS.pad.ZeroPadding = {
  4542. pad: function (data, blockSize) {
  4543. // Shortcut
  4544. var blockSizeBytes = blockSize * 4;
  4545. // Pad
  4546. data.clamp();
  4547. data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes);
  4548. },
  4549. unpad: function (data) {
  4550. // Shortcut
  4551. var dataWords = data.words;
  4552. // Unpad
  4553. var i = data.sigBytes - 1;
  4554. for (var i = data.sigBytes - 1; i >= 0; i--) {
  4555. if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {
  4556. data.sigBytes = i + 1;
  4557. break;
  4558. }
  4559. }
  4560. }
  4561. };
  4562. return CryptoJS.pad.ZeroPadding;
  4563. }));
  4564. }, function(modId) { var map = {"./core":1733984946567,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  4565. __DEFINE__(1733984946594, function(require, module, exports) {
  4566. ;(function (root, factory, undef) {
  4567. if (typeof exports === "object") {
  4568. // CommonJS
  4569. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4570. }
  4571. else if (typeof define === "function" && define.amd) {
  4572. // AMD
  4573. define(["./core", "./cipher-core"], factory);
  4574. }
  4575. else {
  4576. // Global (browser)
  4577. factory(root.CryptoJS);
  4578. }
  4579. }(this, function (CryptoJS) {
  4580. /**
  4581. * A noop padding strategy.
  4582. */
  4583. CryptoJS.pad.NoPadding = {
  4584. pad: function () {
  4585. },
  4586. unpad: function () {
  4587. }
  4588. };
  4589. return CryptoJS.pad.NoPadding;
  4590. }));
  4591. }, function(modId) { var map = {"./core":1733984946567,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  4592. __DEFINE__(1733984946595, function(require, module, exports) {
  4593. ;(function (root, factory, undef) {
  4594. if (typeof exports === "object") {
  4595. // CommonJS
  4596. module.exports = exports = factory(require("./core"), require("./cipher-core"));
  4597. }
  4598. else if (typeof define === "function" && define.amd) {
  4599. // AMD
  4600. define(["./core", "./cipher-core"], factory);
  4601. }
  4602. else {
  4603. // Global (browser)
  4604. factory(root.CryptoJS);
  4605. }
  4606. }(this, function (CryptoJS) {
  4607. (function (undefined) {
  4608. // Shortcuts
  4609. var C = CryptoJS;
  4610. var C_lib = C.lib;
  4611. var CipherParams = C_lib.CipherParams;
  4612. var C_enc = C.enc;
  4613. var Hex = C_enc.Hex;
  4614. var C_format = C.format;
  4615. var HexFormatter = C_format.Hex = {
  4616. /**
  4617. * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
  4618. *
  4619. * @param {CipherParams} cipherParams The cipher params object.
  4620. *
  4621. * @return {string} The hexadecimally encoded string.
  4622. *
  4623. * @static
  4624. *
  4625. * @example
  4626. *
  4627. * var hexString = CryptoJS.format.Hex.stringify(cipherParams);
  4628. */
  4629. stringify: function (cipherParams) {
  4630. return cipherParams.ciphertext.toString(Hex);
  4631. },
  4632. /**
  4633. * Converts a hexadecimally encoded ciphertext string to a cipher params object.
  4634. *
  4635. * @param {string} input The hexadecimally encoded string.
  4636. *
  4637. * @return {CipherParams} The cipher params object.
  4638. *
  4639. * @static
  4640. *
  4641. * @example
  4642. *
  4643. * var cipherParams = CryptoJS.format.Hex.parse(hexString);
  4644. */
  4645. parse: function (input) {
  4646. var ciphertext = Hex.parse(input);
  4647. return CipherParams.create({ ciphertext: ciphertext });
  4648. }
  4649. };
  4650. }());
  4651. return CryptoJS.format.Hex;
  4652. }));
  4653. }, function(modId) { var map = {"./core":1733984946567,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  4654. __DEFINE__(1733984946596, function(require, module, exports) {
  4655. ;(function (root, factory, undef) {
  4656. if (typeof exports === "object") {
  4657. // CommonJS
  4658. module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
  4659. }
  4660. else if (typeof define === "function" && define.amd) {
  4661. // AMD
  4662. define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
  4663. }
  4664. else {
  4665. // Global (browser)
  4666. factory(root.CryptoJS);
  4667. }
  4668. }(this, function (CryptoJS) {
  4669. (function () {
  4670. // Shortcuts
  4671. var C = CryptoJS;
  4672. var C_lib = C.lib;
  4673. var BlockCipher = C_lib.BlockCipher;
  4674. var C_algo = C.algo;
  4675. // Lookup tables
  4676. var SBOX = [];
  4677. var INV_SBOX = [];
  4678. var SUB_MIX_0 = [];
  4679. var SUB_MIX_1 = [];
  4680. var SUB_MIX_2 = [];
  4681. var SUB_MIX_3 = [];
  4682. var INV_SUB_MIX_0 = [];
  4683. var INV_SUB_MIX_1 = [];
  4684. var INV_SUB_MIX_2 = [];
  4685. var INV_SUB_MIX_3 = [];
  4686. // Compute lookup tables
  4687. (function () {
  4688. // Compute double table
  4689. var d = [];
  4690. for (var i = 0; i < 256; i++) {
  4691. if (i < 128) {
  4692. d[i] = i << 1;
  4693. } else {
  4694. d[i] = (i << 1) ^ 0x11b;
  4695. }
  4696. }
  4697. // Walk GF(2^8)
  4698. var x = 0;
  4699. var xi = 0;
  4700. for (var i = 0; i < 256; i++) {
  4701. // Compute sbox
  4702. var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
  4703. sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
  4704. SBOX[x] = sx;
  4705. INV_SBOX[sx] = x;
  4706. // Compute multiplication
  4707. var x2 = d[x];
  4708. var x4 = d[x2];
  4709. var x8 = d[x4];
  4710. // Compute sub bytes, mix columns tables
  4711. var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
  4712. SUB_MIX_0[x] = (t << 24) | (t >>> 8);
  4713. SUB_MIX_1[x] = (t << 16) | (t >>> 16);
  4714. SUB_MIX_2[x] = (t << 8) | (t >>> 24);
  4715. SUB_MIX_3[x] = t;
  4716. // Compute inv sub bytes, inv mix columns tables
  4717. var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
  4718. INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
  4719. INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
  4720. INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
  4721. INV_SUB_MIX_3[sx] = t;
  4722. // Compute next counter
  4723. if (!x) {
  4724. x = xi = 1;
  4725. } else {
  4726. x = x2 ^ d[d[d[x8 ^ x2]]];
  4727. xi ^= d[d[xi]];
  4728. }
  4729. }
  4730. }());
  4731. // Precomputed Rcon lookup
  4732. var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
  4733. /**
  4734. * AES block cipher algorithm.
  4735. */
  4736. var AES = C_algo.AES = BlockCipher.extend({
  4737. _doReset: function () {
  4738. var t;
  4739. // Skip reset of nRounds has been set before and key did not change
  4740. if (this._nRounds && this._keyPriorReset === this._key) {
  4741. return;
  4742. }
  4743. // Shortcuts
  4744. var key = this._keyPriorReset = this._key;
  4745. var keyWords = key.words;
  4746. var keySize = key.sigBytes / 4;
  4747. // Compute number of rounds
  4748. var nRounds = this._nRounds = keySize + 6;
  4749. // Compute number of key schedule rows
  4750. var ksRows = (nRounds + 1) * 4;
  4751. // Compute key schedule
  4752. var keySchedule = this._keySchedule = [];
  4753. for (var ksRow = 0; ksRow < ksRows; ksRow++) {
  4754. if (ksRow < keySize) {
  4755. keySchedule[ksRow] = keyWords[ksRow];
  4756. } else {
  4757. t = keySchedule[ksRow - 1];
  4758. if (!(ksRow % keySize)) {
  4759. // Rot word
  4760. t = (t << 8) | (t >>> 24);
  4761. // Sub word
  4762. t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
  4763. // Mix Rcon
  4764. t ^= RCON[(ksRow / keySize) | 0] << 24;
  4765. } else if (keySize > 6 && ksRow % keySize == 4) {
  4766. // Sub word
  4767. t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
  4768. }
  4769. keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
  4770. }
  4771. }
  4772. // Compute inv key schedule
  4773. var invKeySchedule = this._invKeySchedule = [];
  4774. for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
  4775. var ksRow = ksRows - invKsRow;
  4776. if (invKsRow % 4) {
  4777. var t = keySchedule[ksRow];
  4778. } else {
  4779. var t = keySchedule[ksRow - 4];
  4780. }
  4781. if (invKsRow < 4 || ksRow <= 4) {
  4782. invKeySchedule[invKsRow] = t;
  4783. } else {
  4784. invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
  4785. INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
  4786. }
  4787. }
  4788. },
  4789. encryptBlock: function (M, offset) {
  4790. this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
  4791. },
  4792. decryptBlock: function (M, offset) {
  4793. // Swap 2nd and 4th rows
  4794. var t = M[offset + 1];
  4795. M[offset + 1] = M[offset + 3];
  4796. M[offset + 3] = t;
  4797. this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
  4798. // Inv swap 2nd and 4th rows
  4799. var t = M[offset + 1];
  4800. M[offset + 1] = M[offset + 3];
  4801. M[offset + 3] = t;
  4802. },
  4803. _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
  4804. // Shortcut
  4805. var nRounds = this._nRounds;
  4806. // Get input, add round key
  4807. var s0 = M[offset] ^ keySchedule[0];
  4808. var s1 = M[offset + 1] ^ keySchedule[1];
  4809. var s2 = M[offset + 2] ^ keySchedule[2];
  4810. var s3 = M[offset + 3] ^ keySchedule[3];
  4811. // Key schedule row counter
  4812. var ksRow = 4;
  4813. // Rounds
  4814. for (var round = 1; round < nRounds; round++) {
  4815. // Shift rows, sub bytes, mix columns, add round key
  4816. var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
  4817. var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
  4818. var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
  4819. var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
  4820. // Update state
  4821. s0 = t0;
  4822. s1 = t1;
  4823. s2 = t2;
  4824. s3 = t3;
  4825. }
  4826. // Shift rows, sub bytes, add round key
  4827. var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
  4828. var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
  4829. var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
  4830. var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
  4831. // Set output
  4832. M[offset] = t0;
  4833. M[offset + 1] = t1;
  4834. M[offset + 2] = t2;
  4835. M[offset + 3] = t3;
  4836. },
  4837. keySize: 256/32
  4838. });
  4839. /**
  4840. * Shortcut functions to the cipher's object interface.
  4841. *
  4842. * @example
  4843. *
  4844. * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
  4845. * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
  4846. */
  4847. C.AES = BlockCipher._createHelper(AES);
  4848. }());
  4849. return CryptoJS.AES;
  4850. }));
  4851. }, function(modId) { var map = {"./core":1733984946567,"./enc-base64":1733984946571,"./md5":1733984946573,"./evpkdf":1733984946583,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  4852. __DEFINE__(1733984946597, function(require, module, exports) {
  4853. ;(function (root, factory, undef) {
  4854. if (typeof exports === "object") {
  4855. // CommonJS
  4856. module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
  4857. }
  4858. else if (typeof define === "function" && define.amd) {
  4859. // AMD
  4860. define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
  4861. }
  4862. else {
  4863. // Global (browser)
  4864. factory(root.CryptoJS);
  4865. }
  4866. }(this, function (CryptoJS) {
  4867. (function () {
  4868. // Shortcuts
  4869. var C = CryptoJS;
  4870. var C_lib = C.lib;
  4871. var WordArray = C_lib.WordArray;
  4872. var BlockCipher = C_lib.BlockCipher;
  4873. var C_algo = C.algo;
  4874. // Permuted Choice 1 constants
  4875. var PC1 = [
  4876. 57, 49, 41, 33, 25, 17, 9, 1,
  4877. 58, 50, 42, 34, 26, 18, 10, 2,
  4878. 59, 51, 43, 35, 27, 19, 11, 3,
  4879. 60, 52, 44, 36, 63, 55, 47, 39,
  4880. 31, 23, 15, 7, 62, 54, 46, 38,
  4881. 30, 22, 14, 6, 61, 53, 45, 37,
  4882. 29, 21, 13, 5, 28, 20, 12, 4
  4883. ];
  4884. // Permuted Choice 2 constants
  4885. var PC2 = [
  4886. 14, 17, 11, 24, 1, 5,
  4887. 3, 28, 15, 6, 21, 10,
  4888. 23, 19, 12, 4, 26, 8,
  4889. 16, 7, 27, 20, 13, 2,
  4890. 41, 52, 31, 37, 47, 55,
  4891. 30, 40, 51, 45, 33, 48,
  4892. 44, 49, 39, 56, 34, 53,
  4893. 46, 42, 50, 36, 29, 32
  4894. ];
  4895. // Cumulative bit shift constants
  4896. var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
  4897. // SBOXes and round permutation constants
  4898. var SBOX_P = [
  4899. {
  4900. 0x0: 0x808200,
  4901. 0x10000000: 0x8000,
  4902. 0x20000000: 0x808002,
  4903. 0x30000000: 0x2,
  4904. 0x40000000: 0x200,
  4905. 0x50000000: 0x808202,
  4906. 0x60000000: 0x800202,
  4907. 0x70000000: 0x800000,
  4908. 0x80000000: 0x202,
  4909. 0x90000000: 0x800200,
  4910. 0xa0000000: 0x8200,
  4911. 0xb0000000: 0x808000,
  4912. 0xc0000000: 0x8002,
  4913. 0xd0000000: 0x800002,
  4914. 0xe0000000: 0x0,
  4915. 0xf0000000: 0x8202,
  4916. 0x8000000: 0x0,
  4917. 0x18000000: 0x808202,
  4918. 0x28000000: 0x8202,
  4919. 0x38000000: 0x8000,
  4920. 0x48000000: 0x808200,
  4921. 0x58000000: 0x200,
  4922. 0x68000000: 0x808002,
  4923. 0x78000000: 0x2,
  4924. 0x88000000: 0x800200,
  4925. 0x98000000: 0x8200,
  4926. 0xa8000000: 0x808000,
  4927. 0xb8000000: 0x800202,
  4928. 0xc8000000: 0x800002,
  4929. 0xd8000000: 0x8002,
  4930. 0xe8000000: 0x202,
  4931. 0xf8000000: 0x800000,
  4932. 0x1: 0x8000,
  4933. 0x10000001: 0x2,
  4934. 0x20000001: 0x808200,
  4935. 0x30000001: 0x800000,
  4936. 0x40000001: 0x808002,
  4937. 0x50000001: 0x8200,
  4938. 0x60000001: 0x200,
  4939. 0x70000001: 0x800202,
  4940. 0x80000001: 0x808202,
  4941. 0x90000001: 0x808000,
  4942. 0xa0000001: 0x800002,
  4943. 0xb0000001: 0x8202,
  4944. 0xc0000001: 0x202,
  4945. 0xd0000001: 0x800200,
  4946. 0xe0000001: 0x8002,
  4947. 0xf0000001: 0x0,
  4948. 0x8000001: 0x808202,
  4949. 0x18000001: 0x808000,
  4950. 0x28000001: 0x800000,
  4951. 0x38000001: 0x200,
  4952. 0x48000001: 0x8000,
  4953. 0x58000001: 0x800002,
  4954. 0x68000001: 0x2,
  4955. 0x78000001: 0x8202,
  4956. 0x88000001: 0x8002,
  4957. 0x98000001: 0x800202,
  4958. 0xa8000001: 0x202,
  4959. 0xb8000001: 0x808200,
  4960. 0xc8000001: 0x800200,
  4961. 0xd8000001: 0x0,
  4962. 0xe8000001: 0x8200,
  4963. 0xf8000001: 0x808002
  4964. },
  4965. {
  4966. 0x0: 0x40084010,
  4967. 0x1000000: 0x4000,
  4968. 0x2000000: 0x80000,
  4969. 0x3000000: 0x40080010,
  4970. 0x4000000: 0x40000010,
  4971. 0x5000000: 0x40084000,
  4972. 0x6000000: 0x40004000,
  4973. 0x7000000: 0x10,
  4974. 0x8000000: 0x84000,
  4975. 0x9000000: 0x40004010,
  4976. 0xa000000: 0x40000000,
  4977. 0xb000000: 0x84010,
  4978. 0xc000000: 0x80010,
  4979. 0xd000000: 0x0,
  4980. 0xe000000: 0x4010,
  4981. 0xf000000: 0x40080000,
  4982. 0x800000: 0x40004000,
  4983. 0x1800000: 0x84010,
  4984. 0x2800000: 0x10,
  4985. 0x3800000: 0x40004010,
  4986. 0x4800000: 0x40084010,
  4987. 0x5800000: 0x40000000,
  4988. 0x6800000: 0x80000,
  4989. 0x7800000: 0x40080010,
  4990. 0x8800000: 0x80010,
  4991. 0x9800000: 0x0,
  4992. 0xa800000: 0x4000,
  4993. 0xb800000: 0x40080000,
  4994. 0xc800000: 0x40000010,
  4995. 0xd800000: 0x84000,
  4996. 0xe800000: 0x40084000,
  4997. 0xf800000: 0x4010,
  4998. 0x10000000: 0x0,
  4999. 0x11000000: 0x40080010,
  5000. 0x12000000: 0x40004010,
  5001. 0x13000000: 0x40084000,
  5002. 0x14000000: 0x40080000,
  5003. 0x15000000: 0x10,
  5004. 0x16000000: 0x84010,
  5005. 0x17000000: 0x4000,
  5006. 0x18000000: 0x4010,
  5007. 0x19000000: 0x80000,
  5008. 0x1a000000: 0x80010,
  5009. 0x1b000000: 0x40000010,
  5010. 0x1c000000: 0x84000,
  5011. 0x1d000000: 0x40004000,
  5012. 0x1e000000: 0x40000000,
  5013. 0x1f000000: 0x40084010,
  5014. 0x10800000: 0x84010,
  5015. 0x11800000: 0x80000,
  5016. 0x12800000: 0x40080000,
  5017. 0x13800000: 0x4000,
  5018. 0x14800000: 0x40004000,
  5019. 0x15800000: 0x40084010,
  5020. 0x16800000: 0x10,
  5021. 0x17800000: 0x40000000,
  5022. 0x18800000: 0x40084000,
  5023. 0x19800000: 0x40000010,
  5024. 0x1a800000: 0x40004010,
  5025. 0x1b800000: 0x80010,
  5026. 0x1c800000: 0x0,
  5027. 0x1d800000: 0x4010,
  5028. 0x1e800000: 0x40080010,
  5029. 0x1f800000: 0x84000
  5030. },
  5031. {
  5032. 0x0: 0x104,
  5033. 0x100000: 0x0,
  5034. 0x200000: 0x4000100,
  5035. 0x300000: 0x10104,
  5036. 0x400000: 0x10004,
  5037. 0x500000: 0x4000004,
  5038. 0x600000: 0x4010104,
  5039. 0x700000: 0x4010000,
  5040. 0x800000: 0x4000000,
  5041. 0x900000: 0x4010100,
  5042. 0xa00000: 0x10100,
  5043. 0xb00000: 0x4010004,
  5044. 0xc00000: 0x4000104,
  5045. 0xd00000: 0x10000,
  5046. 0xe00000: 0x4,
  5047. 0xf00000: 0x100,
  5048. 0x80000: 0x4010100,
  5049. 0x180000: 0x4010004,
  5050. 0x280000: 0x0,
  5051. 0x380000: 0x4000100,
  5052. 0x480000: 0x4000004,
  5053. 0x580000: 0x10000,
  5054. 0x680000: 0x10004,
  5055. 0x780000: 0x104,
  5056. 0x880000: 0x4,
  5057. 0x980000: 0x100,
  5058. 0xa80000: 0x4010000,
  5059. 0xb80000: 0x10104,
  5060. 0xc80000: 0x10100,
  5061. 0xd80000: 0x4000104,
  5062. 0xe80000: 0x4010104,
  5063. 0xf80000: 0x4000000,
  5064. 0x1000000: 0x4010100,
  5065. 0x1100000: 0x10004,
  5066. 0x1200000: 0x10000,
  5067. 0x1300000: 0x4000100,
  5068. 0x1400000: 0x100,
  5069. 0x1500000: 0x4010104,
  5070. 0x1600000: 0x4000004,
  5071. 0x1700000: 0x0,
  5072. 0x1800000: 0x4000104,
  5073. 0x1900000: 0x4000000,
  5074. 0x1a00000: 0x4,
  5075. 0x1b00000: 0x10100,
  5076. 0x1c00000: 0x4010000,
  5077. 0x1d00000: 0x104,
  5078. 0x1e00000: 0x10104,
  5079. 0x1f00000: 0x4010004,
  5080. 0x1080000: 0x4000000,
  5081. 0x1180000: 0x104,
  5082. 0x1280000: 0x4010100,
  5083. 0x1380000: 0x0,
  5084. 0x1480000: 0x10004,
  5085. 0x1580000: 0x4000100,
  5086. 0x1680000: 0x100,
  5087. 0x1780000: 0x4010004,
  5088. 0x1880000: 0x10000,
  5089. 0x1980000: 0x4010104,
  5090. 0x1a80000: 0x10104,
  5091. 0x1b80000: 0x4000004,
  5092. 0x1c80000: 0x4000104,
  5093. 0x1d80000: 0x4010000,
  5094. 0x1e80000: 0x4,
  5095. 0x1f80000: 0x10100
  5096. },
  5097. {
  5098. 0x0: 0x80401000,
  5099. 0x10000: 0x80001040,
  5100. 0x20000: 0x401040,
  5101. 0x30000: 0x80400000,
  5102. 0x40000: 0x0,
  5103. 0x50000: 0x401000,
  5104. 0x60000: 0x80000040,
  5105. 0x70000: 0x400040,
  5106. 0x80000: 0x80000000,
  5107. 0x90000: 0x400000,
  5108. 0xa0000: 0x40,
  5109. 0xb0000: 0x80001000,
  5110. 0xc0000: 0x80400040,
  5111. 0xd0000: 0x1040,
  5112. 0xe0000: 0x1000,
  5113. 0xf0000: 0x80401040,
  5114. 0x8000: 0x80001040,
  5115. 0x18000: 0x40,
  5116. 0x28000: 0x80400040,
  5117. 0x38000: 0x80001000,
  5118. 0x48000: 0x401000,
  5119. 0x58000: 0x80401040,
  5120. 0x68000: 0x0,
  5121. 0x78000: 0x80400000,
  5122. 0x88000: 0x1000,
  5123. 0x98000: 0x80401000,
  5124. 0xa8000: 0x400000,
  5125. 0xb8000: 0x1040,
  5126. 0xc8000: 0x80000000,
  5127. 0xd8000: 0x400040,
  5128. 0xe8000: 0x401040,
  5129. 0xf8000: 0x80000040,
  5130. 0x100000: 0x400040,
  5131. 0x110000: 0x401000,
  5132. 0x120000: 0x80000040,
  5133. 0x130000: 0x0,
  5134. 0x140000: 0x1040,
  5135. 0x150000: 0x80400040,
  5136. 0x160000: 0x80401000,
  5137. 0x170000: 0x80001040,
  5138. 0x180000: 0x80401040,
  5139. 0x190000: 0x80000000,
  5140. 0x1a0000: 0x80400000,
  5141. 0x1b0000: 0x401040,
  5142. 0x1c0000: 0x80001000,
  5143. 0x1d0000: 0x400000,
  5144. 0x1e0000: 0x40,
  5145. 0x1f0000: 0x1000,
  5146. 0x108000: 0x80400000,
  5147. 0x118000: 0x80401040,
  5148. 0x128000: 0x0,
  5149. 0x138000: 0x401000,
  5150. 0x148000: 0x400040,
  5151. 0x158000: 0x80000000,
  5152. 0x168000: 0x80001040,
  5153. 0x178000: 0x40,
  5154. 0x188000: 0x80000040,
  5155. 0x198000: 0x1000,
  5156. 0x1a8000: 0x80001000,
  5157. 0x1b8000: 0x80400040,
  5158. 0x1c8000: 0x1040,
  5159. 0x1d8000: 0x80401000,
  5160. 0x1e8000: 0x400000,
  5161. 0x1f8000: 0x401040
  5162. },
  5163. {
  5164. 0x0: 0x80,
  5165. 0x1000: 0x1040000,
  5166. 0x2000: 0x40000,
  5167. 0x3000: 0x20000000,
  5168. 0x4000: 0x20040080,
  5169. 0x5000: 0x1000080,
  5170. 0x6000: 0x21000080,
  5171. 0x7000: 0x40080,
  5172. 0x8000: 0x1000000,
  5173. 0x9000: 0x20040000,
  5174. 0xa000: 0x20000080,
  5175. 0xb000: 0x21040080,
  5176. 0xc000: 0x21040000,
  5177. 0xd000: 0x0,
  5178. 0xe000: 0x1040080,
  5179. 0xf000: 0x21000000,
  5180. 0x800: 0x1040080,
  5181. 0x1800: 0x21000080,
  5182. 0x2800: 0x80,
  5183. 0x3800: 0x1040000,
  5184. 0x4800: 0x40000,
  5185. 0x5800: 0x20040080,
  5186. 0x6800: 0x21040000,
  5187. 0x7800: 0x20000000,
  5188. 0x8800: 0x20040000,
  5189. 0x9800: 0x0,
  5190. 0xa800: 0x21040080,
  5191. 0xb800: 0x1000080,
  5192. 0xc800: 0x20000080,
  5193. 0xd800: 0x21000000,
  5194. 0xe800: 0x1000000,
  5195. 0xf800: 0x40080,
  5196. 0x10000: 0x40000,
  5197. 0x11000: 0x80,
  5198. 0x12000: 0x20000000,
  5199. 0x13000: 0x21000080,
  5200. 0x14000: 0x1000080,
  5201. 0x15000: 0x21040000,
  5202. 0x16000: 0x20040080,
  5203. 0x17000: 0x1000000,
  5204. 0x18000: 0x21040080,
  5205. 0x19000: 0x21000000,
  5206. 0x1a000: 0x1040000,
  5207. 0x1b000: 0x20040000,
  5208. 0x1c000: 0x40080,
  5209. 0x1d000: 0x20000080,
  5210. 0x1e000: 0x0,
  5211. 0x1f000: 0x1040080,
  5212. 0x10800: 0x21000080,
  5213. 0x11800: 0x1000000,
  5214. 0x12800: 0x1040000,
  5215. 0x13800: 0x20040080,
  5216. 0x14800: 0x20000000,
  5217. 0x15800: 0x1040080,
  5218. 0x16800: 0x80,
  5219. 0x17800: 0x21040000,
  5220. 0x18800: 0x40080,
  5221. 0x19800: 0x21040080,
  5222. 0x1a800: 0x0,
  5223. 0x1b800: 0x21000000,
  5224. 0x1c800: 0x1000080,
  5225. 0x1d800: 0x40000,
  5226. 0x1e800: 0x20040000,
  5227. 0x1f800: 0x20000080
  5228. },
  5229. {
  5230. 0x0: 0x10000008,
  5231. 0x100: 0x2000,
  5232. 0x200: 0x10200000,
  5233. 0x300: 0x10202008,
  5234. 0x400: 0x10002000,
  5235. 0x500: 0x200000,
  5236. 0x600: 0x200008,
  5237. 0x700: 0x10000000,
  5238. 0x800: 0x0,
  5239. 0x900: 0x10002008,
  5240. 0xa00: 0x202000,
  5241. 0xb00: 0x8,
  5242. 0xc00: 0x10200008,
  5243. 0xd00: 0x202008,
  5244. 0xe00: 0x2008,
  5245. 0xf00: 0x10202000,
  5246. 0x80: 0x10200000,
  5247. 0x180: 0x10202008,
  5248. 0x280: 0x8,
  5249. 0x380: 0x200000,
  5250. 0x480: 0x202008,
  5251. 0x580: 0x10000008,
  5252. 0x680: 0x10002000,
  5253. 0x780: 0x2008,
  5254. 0x880: 0x200008,
  5255. 0x980: 0x2000,
  5256. 0xa80: 0x10002008,
  5257. 0xb80: 0x10200008,
  5258. 0xc80: 0x0,
  5259. 0xd80: 0x10202000,
  5260. 0xe80: 0x202000,
  5261. 0xf80: 0x10000000,
  5262. 0x1000: 0x10002000,
  5263. 0x1100: 0x10200008,
  5264. 0x1200: 0x10202008,
  5265. 0x1300: 0x2008,
  5266. 0x1400: 0x200000,
  5267. 0x1500: 0x10000000,
  5268. 0x1600: 0x10000008,
  5269. 0x1700: 0x202000,
  5270. 0x1800: 0x202008,
  5271. 0x1900: 0x0,
  5272. 0x1a00: 0x8,
  5273. 0x1b00: 0x10200000,
  5274. 0x1c00: 0x2000,
  5275. 0x1d00: 0x10002008,
  5276. 0x1e00: 0x10202000,
  5277. 0x1f00: 0x200008,
  5278. 0x1080: 0x8,
  5279. 0x1180: 0x202000,
  5280. 0x1280: 0x200000,
  5281. 0x1380: 0x10000008,
  5282. 0x1480: 0x10002000,
  5283. 0x1580: 0x2008,
  5284. 0x1680: 0x10202008,
  5285. 0x1780: 0x10200000,
  5286. 0x1880: 0x10202000,
  5287. 0x1980: 0x10200008,
  5288. 0x1a80: 0x2000,
  5289. 0x1b80: 0x202008,
  5290. 0x1c80: 0x200008,
  5291. 0x1d80: 0x0,
  5292. 0x1e80: 0x10000000,
  5293. 0x1f80: 0x10002008
  5294. },
  5295. {
  5296. 0x0: 0x100000,
  5297. 0x10: 0x2000401,
  5298. 0x20: 0x400,
  5299. 0x30: 0x100401,
  5300. 0x40: 0x2100401,
  5301. 0x50: 0x0,
  5302. 0x60: 0x1,
  5303. 0x70: 0x2100001,
  5304. 0x80: 0x2000400,
  5305. 0x90: 0x100001,
  5306. 0xa0: 0x2000001,
  5307. 0xb0: 0x2100400,
  5308. 0xc0: 0x2100000,
  5309. 0xd0: 0x401,
  5310. 0xe0: 0x100400,
  5311. 0xf0: 0x2000000,
  5312. 0x8: 0x2100001,
  5313. 0x18: 0x0,
  5314. 0x28: 0x2000401,
  5315. 0x38: 0x2100400,
  5316. 0x48: 0x100000,
  5317. 0x58: 0x2000001,
  5318. 0x68: 0x2000000,
  5319. 0x78: 0x401,
  5320. 0x88: 0x100401,
  5321. 0x98: 0x2000400,
  5322. 0xa8: 0x2100000,
  5323. 0xb8: 0x100001,
  5324. 0xc8: 0x400,
  5325. 0xd8: 0x2100401,
  5326. 0xe8: 0x1,
  5327. 0xf8: 0x100400,
  5328. 0x100: 0x2000000,
  5329. 0x110: 0x100000,
  5330. 0x120: 0x2000401,
  5331. 0x130: 0x2100001,
  5332. 0x140: 0x100001,
  5333. 0x150: 0x2000400,
  5334. 0x160: 0x2100400,
  5335. 0x170: 0x100401,
  5336. 0x180: 0x401,
  5337. 0x190: 0x2100401,
  5338. 0x1a0: 0x100400,
  5339. 0x1b0: 0x1,
  5340. 0x1c0: 0x0,
  5341. 0x1d0: 0x2100000,
  5342. 0x1e0: 0x2000001,
  5343. 0x1f0: 0x400,
  5344. 0x108: 0x100400,
  5345. 0x118: 0x2000401,
  5346. 0x128: 0x2100001,
  5347. 0x138: 0x1,
  5348. 0x148: 0x2000000,
  5349. 0x158: 0x100000,
  5350. 0x168: 0x401,
  5351. 0x178: 0x2100400,
  5352. 0x188: 0x2000001,
  5353. 0x198: 0x2100000,
  5354. 0x1a8: 0x0,
  5355. 0x1b8: 0x2100401,
  5356. 0x1c8: 0x100401,
  5357. 0x1d8: 0x400,
  5358. 0x1e8: 0x2000400,
  5359. 0x1f8: 0x100001
  5360. },
  5361. {
  5362. 0x0: 0x8000820,
  5363. 0x1: 0x20000,
  5364. 0x2: 0x8000000,
  5365. 0x3: 0x20,
  5366. 0x4: 0x20020,
  5367. 0x5: 0x8020820,
  5368. 0x6: 0x8020800,
  5369. 0x7: 0x800,
  5370. 0x8: 0x8020000,
  5371. 0x9: 0x8000800,
  5372. 0xa: 0x20800,
  5373. 0xb: 0x8020020,
  5374. 0xc: 0x820,
  5375. 0xd: 0x0,
  5376. 0xe: 0x8000020,
  5377. 0xf: 0x20820,
  5378. 0x80000000: 0x800,
  5379. 0x80000001: 0x8020820,
  5380. 0x80000002: 0x8000820,
  5381. 0x80000003: 0x8000000,
  5382. 0x80000004: 0x8020000,
  5383. 0x80000005: 0x20800,
  5384. 0x80000006: 0x20820,
  5385. 0x80000007: 0x20,
  5386. 0x80000008: 0x8000020,
  5387. 0x80000009: 0x820,
  5388. 0x8000000a: 0x20020,
  5389. 0x8000000b: 0x8020800,
  5390. 0x8000000c: 0x0,
  5391. 0x8000000d: 0x8020020,
  5392. 0x8000000e: 0x8000800,
  5393. 0x8000000f: 0x20000,
  5394. 0x10: 0x20820,
  5395. 0x11: 0x8020800,
  5396. 0x12: 0x20,
  5397. 0x13: 0x800,
  5398. 0x14: 0x8000800,
  5399. 0x15: 0x8000020,
  5400. 0x16: 0x8020020,
  5401. 0x17: 0x20000,
  5402. 0x18: 0x0,
  5403. 0x19: 0x20020,
  5404. 0x1a: 0x8020000,
  5405. 0x1b: 0x8000820,
  5406. 0x1c: 0x8020820,
  5407. 0x1d: 0x20800,
  5408. 0x1e: 0x820,
  5409. 0x1f: 0x8000000,
  5410. 0x80000010: 0x20000,
  5411. 0x80000011: 0x800,
  5412. 0x80000012: 0x8020020,
  5413. 0x80000013: 0x20820,
  5414. 0x80000014: 0x20,
  5415. 0x80000015: 0x8020000,
  5416. 0x80000016: 0x8000000,
  5417. 0x80000017: 0x8000820,
  5418. 0x80000018: 0x8020820,
  5419. 0x80000019: 0x8000020,
  5420. 0x8000001a: 0x8000800,
  5421. 0x8000001b: 0x0,
  5422. 0x8000001c: 0x20800,
  5423. 0x8000001d: 0x820,
  5424. 0x8000001e: 0x20020,
  5425. 0x8000001f: 0x8020800
  5426. }
  5427. ];
  5428. // Masks that select the SBOX input
  5429. var SBOX_MASK = [
  5430. 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000,
  5431. 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f
  5432. ];
  5433. /**
  5434. * DES block cipher algorithm.
  5435. */
  5436. var DES = C_algo.DES = BlockCipher.extend({
  5437. _doReset: function () {
  5438. // Shortcuts
  5439. var key = this._key;
  5440. var keyWords = key.words;
  5441. // Select 56 bits according to PC1
  5442. var keyBits = [];
  5443. for (var i = 0; i < 56; i++) {
  5444. var keyBitPos = PC1[i] - 1;
  5445. keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1;
  5446. }
  5447. // Assemble 16 subkeys
  5448. var subKeys = this._subKeys = [];
  5449. for (var nSubKey = 0; nSubKey < 16; nSubKey++) {
  5450. // Create subkey
  5451. var subKey = subKeys[nSubKey] = [];
  5452. // Shortcut
  5453. var bitShift = BIT_SHIFTS[nSubKey];
  5454. // Select 48 bits according to PC2
  5455. for (var i = 0; i < 24; i++) {
  5456. // Select from the left 28 key bits
  5457. subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6);
  5458. // Select from the right 28 key bits
  5459. subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6);
  5460. }
  5461. // Since each subkey is applied to an expanded 32-bit input,
  5462. // the subkey can be broken into 8 values scaled to 32-bits,
  5463. // which allows the key to be used without expansion
  5464. subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31);
  5465. for (var i = 1; i < 7; i++) {
  5466. subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3);
  5467. }
  5468. subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27);
  5469. }
  5470. // Compute inverse subkeys
  5471. var invSubKeys = this._invSubKeys = [];
  5472. for (var i = 0; i < 16; i++) {
  5473. invSubKeys[i] = subKeys[15 - i];
  5474. }
  5475. },
  5476. encryptBlock: function (M, offset) {
  5477. this._doCryptBlock(M, offset, this._subKeys);
  5478. },
  5479. decryptBlock: function (M, offset) {
  5480. this._doCryptBlock(M, offset, this._invSubKeys);
  5481. },
  5482. _doCryptBlock: function (M, offset, subKeys) {
  5483. // Get input
  5484. this._lBlock = M[offset];
  5485. this._rBlock = M[offset + 1];
  5486. // Initial permutation
  5487. exchangeLR.call(this, 4, 0x0f0f0f0f);
  5488. exchangeLR.call(this, 16, 0x0000ffff);
  5489. exchangeRL.call(this, 2, 0x33333333);
  5490. exchangeRL.call(this, 8, 0x00ff00ff);
  5491. exchangeLR.call(this, 1, 0x55555555);
  5492. // Rounds
  5493. for (var round = 0; round < 16; round++) {
  5494. // Shortcuts
  5495. var subKey = subKeys[round];
  5496. var lBlock = this._lBlock;
  5497. var rBlock = this._rBlock;
  5498. // Feistel function
  5499. var f = 0;
  5500. for (var i = 0; i < 8; i++) {
  5501. f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0];
  5502. }
  5503. this._lBlock = rBlock;
  5504. this._rBlock = lBlock ^ f;
  5505. }
  5506. // Undo swap from last round
  5507. var t = this._lBlock;
  5508. this._lBlock = this._rBlock;
  5509. this._rBlock = t;
  5510. // Final permutation
  5511. exchangeLR.call(this, 1, 0x55555555);
  5512. exchangeRL.call(this, 8, 0x00ff00ff);
  5513. exchangeRL.call(this, 2, 0x33333333);
  5514. exchangeLR.call(this, 16, 0x0000ffff);
  5515. exchangeLR.call(this, 4, 0x0f0f0f0f);
  5516. // Set output
  5517. M[offset] = this._lBlock;
  5518. M[offset + 1] = this._rBlock;
  5519. },
  5520. keySize: 64/32,
  5521. ivSize: 64/32,
  5522. blockSize: 64/32
  5523. });
  5524. // Swap bits across the left and right words
  5525. function exchangeLR(offset, mask) {
  5526. var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask;
  5527. this._rBlock ^= t;
  5528. this._lBlock ^= t << offset;
  5529. }
  5530. function exchangeRL(offset, mask) {
  5531. var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask;
  5532. this._lBlock ^= t;
  5533. this._rBlock ^= t << offset;
  5534. }
  5535. /**
  5536. * Shortcut functions to the cipher's object interface.
  5537. *
  5538. * @example
  5539. *
  5540. * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg);
  5541. * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg);
  5542. */
  5543. C.DES = BlockCipher._createHelper(DES);
  5544. /**
  5545. * Triple-DES block cipher algorithm.
  5546. */
  5547. var TripleDES = C_algo.TripleDES = BlockCipher.extend({
  5548. _doReset: function () {
  5549. // Shortcuts
  5550. var key = this._key;
  5551. var keyWords = key.words;
  5552. // Make sure the key length is valid (64, 128 or >= 192 bit)
  5553. if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) {
  5554. throw new Error('Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.');
  5555. }
  5556. // Extend the key according to the keying options defined in 3DES standard
  5557. var key1 = keyWords.slice(0, 2);
  5558. var key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4);
  5559. var key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6);
  5560. // Create DES instances
  5561. this._des1 = DES.createEncryptor(WordArray.create(key1));
  5562. this._des2 = DES.createEncryptor(WordArray.create(key2));
  5563. this._des3 = DES.createEncryptor(WordArray.create(key3));
  5564. },
  5565. encryptBlock: function (M, offset) {
  5566. this._des1.encryptBlock(M, offset);
  5567. this._des2.decryptBlock(M, offset);
  5568. this._des3.encryptBlock(M, offset);
  5569. },
  5570. decryptBlock: function (M, offset) {
  5571. this._des3.decryptBlock(M, offset);
  5572. this._des2.encryptBlock(M, offset);
  5573. this._des1.decryptBlock(M, offset);
  5574. },
  5575. keySize: 192/32,
  5576. ivSize: 64/32,
  5577. blockSize: 64/32
  5578. });
  5579. /**
  5580. * Shortcut functions to the cipher's object interface.
  5581. *
  5582. * @example
  5583. *
  5584. * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg);
  5585. * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);
  5586. */
  5587. C.TripleDES = BlockCipher._createHelper(TripleDES);
  5588. }());
  5589. return CryptoJS.TripleDES;
  5590. }));
  5591. }, function(modId) { var map = {"./core":1733984946567,"./enc-base64":1733984946571,"./md5":1733984946573,"./evpkdf":1733984946583,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  5592. __DEFINE__(1733984946598, function(require, module, exports) {
  5593. ;(function (root, factory, undef) {
  5594. if (typeof exports === "object") {
  5595. // CommonJS
  5596. module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
  5597. }
  5598. else if (typeof define === "function" && define.amd) {
  5599. // AMD
  5600. define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
  5601. }
  5602. else {
  5603. // Global (browser)
  5604. factory(root.CryptoJS);
  5605. }
  5606. }(this, function (CryptoJS) {
  5607. (function () {
  5608. // Shortcuts
  5609. var C = CryptoJS;
  5610. var C_lib = C.lib;
  5611. var StreamCipher = C_lib.StreamCipher;
  5612. var C_algo = C.algo;
  5613. /**
  5614. * RC4 stream cipher algorithm.
  5615. */
  5616. var RC4 = C_algo.RC4 = StreamCipher.extend({
  5617. _doReset: function () {
  5618. // Shortcuts
  5619. var key = this._key;
  5620. var keyWords = key.words;
  5621. var keySigBytes = key.sigBytes;
  5622. // Init sbox
  5623. var S = this._S = [];
  5624. for (var i = 0; i < 256; i++) {
  5625. S[i] = i;
  5626. }
  5627. // Key setup
  5628. for (var i = 0, j = 0; i < 256; i++) {
  5629. var keyByteIndex = i % keySigBytes;
  5630. var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff;
  5631. j = (j + S[i] + keyByte) % 256;
  5632. // Swap
  5633. var t = S[i];
  5634. S[i] = S[j];
  5635. S[j] = t;
  5636. }
  5637. // Counters
  5638. this._i = this._j = 0;
  5639. },
  5640. _doProcessBlock: function (M, offset) {
  5641. M[offset] ^= generateKeystreamWord.call(this);
  5642. },
  5643. keySize: 256/32,
  5644. ivSize: 0
  5645. });
  5646. function generateKeystreamWord() {
  5647. // Shortcuts
  5648. var S = this._S;
  5649. var i = this._i;
  5650. var j = this._j;
  5651. // Generate keystream word
  5652. var keystreamWord = 0;
  5653. for (var n = 0; n < 4; n++) {
  5654. i = (i + 1) % 256;
  5655. j = (j + S[i]) % 256;
  5656. // Swap
  5657. var t = S[i];
  5658. S[i] = S[j];
  5659. S[j] = t;
  5660. keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8);
  5661. }
  5662. // Update counters
  5663. this._i = i;
  5664. this._j = j;
  5665. return keystreamWord;
  5666. }
  5667. /**
  5668. * Shortcut functions to the cipher's object interface.
  5669. *
  5670. * @example
  5671. *
  5672. * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);
  5673. * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg);
  5674. */
  5675. C.RC4 = StreamCipher._createHelper(RC4);
  5676. /**
  5677. * Modified RC4 stream cipher algorithm.
  5678. */
  5679. var RC4Drop = C_algo.RC4Drop = RC4.extend({
  5680. /**
  5681. * Configuration options.
  5682. *
  5683. * @property {number} drop The number of keystream words to drop. Default 192
  5684. */
  5685. cfg: RC4.cfg.extend({
  5686. drop: 192
  5687. }),
  5688. _doReset: function () {
  5689. RC4._doReset.call(this);
  5690. // Drop
  5691. for (var i = this.cfg.drop; i > 0; i--) {
  5692. generateKeystreamWord.call(this);
  5693. }
  5694. }
  5695. });
  5696. /**
  5697. * Shortcut functions to the cipher's object interface.
  5698. *
  5699. * @example
  5700. *
  5701. * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);
  5702. * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);
  5703. */
  5704. C.RC4Drop = StreamCipher._createHelper(RC4Drop);
  5705. }());
  5706. return CryptoJS.RC4;
  5707. }));
  5708. }, function(modId) { var map = {"./core":1733984946567,"./enc-base64":1733984946571,"./md5":1733984946573,"./evpkdf":1733984946583,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  5709. __DEFINE__(1733984946599, function(require, module, exports) {
  5710. ;(function (root, factory, undef) {
  5711. if (typeof exports === "object") {
  5712. // CommonJS
  5713. module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
  5714. }
  5715. else if (typeof define === "function" && define.amd) {
  5716. // AMD
  5717. define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
  5718. }
  5719. else {
  5720. // Global (browser)
  5721. factory(root.CryptoJS);
  5722. }
  5723. }(this, function (CryptoJS) {
  5724. (function () {
  5725. // Shortcuts
  5726. var C = CryptoJS;
  5727. var C_lib = C.lib;
  5728. var StreamCipher = C_lib.StreamCipher;
  5729. var C_algo = C.algo;
  5730. // Reusable objects
  5731. var S = [];
  5732. var C_ = [];
  5733. var G = [];
  5734. /**
  5735. * Rabbit stream cipher algorithm
  5736. */
  5737. var Rabbit = C_algo.Rabbit = StreamCipher.extend({
  5738. _doReset: function () {
  5739. // Shortcuts
  5740. var K = this._key.words;
  5741. var iv = this.cfg.iv;
  5742. // Swap endian
  5743. for (var i = 0; i < 4; i++) {
  5744. K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) |
  5745. (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00);
  5746. }
  5747. // Generate initial state values
  5748. var X = this._X = [
  5749. K[0], (K[3] << 16) | (K[2] >>> 16),
  5750. K[1], (K[0] << 16) | (K[3] >>> 16),
  5751. K[2], (K[1] << 16) | (K[0] >>> 16),
  5752. K[3], (K[2] << 16) | (K[1] >>> 16)
  5753. ];
  5754. // Generate initial counter values
  5755. var C = this._C = [
  5756. (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
  5757. (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
  5758. (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
  5759. (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
  5760. ];
  5761. // Carry bit
  5762. this._b = 0;
  5763. // Iterate the system four times
  5764. for (var i = 0; i < 4; i++) {
  5765. nextState.call(this);
  5766. }
  5767. // Modify the counters
  5768. for (var i = 0; i < 8; i++) {
  5769. C[i] ^= X[(i + 4) & 7];
  5770. }
  5771. // IV setup
  5772. if (iv) {
  5773. // Shortcuts
  5774. var IV = iv.words;
  5775. var IV_0 = IV[0];
  5776. var IV_1 = IV[1];
  5777. // Generate four subvectors
  5778. var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
  5779. var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
  5780. var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
  5781. var i3 = (i2 << 16) | (i0 & 0x0000ffff);
  5782. // Modify counter values
  5783. C[0] ^= i0;
  5784. C[1] ^= i1;
  5785. C[2] ^= i2;
  5786. C[3] ^= i3;
  5787. C[4] ^= i0;
  5788. C[5] ^= i1;
  5789. C[6] ^= i2;
  5790. C[7] ^= i3;
  5791. // Iterate the system four times
  5792. for (var i = 0; i < 4; i++) {
  5793. nextState.call(this);
  5794. }
  5795. }
  5796. },
  5797. _doProcessBlock: function (M, offset) {
  5798. // Shortcut
  5799. var X = this._X;
  5800. // Iterate the system
  5801. nextState.call(this);
  5802. // Generate four keystream words
  5803. S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
  5804. S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
  5805. S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
  5806. S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
  5807. for (var i = 0; i < 4; i++) {
  5808. // Swap endian
  5809. S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
  5810. (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
  5811. // Encrypt
  5812. M[offset + i] ^= S[i];
  5813. }
  5814. },
  5815. blockSize: 128/32,
  5816. ivSize: 64/32
  5817. });
  5818. function nextState() {
  5819. // Shortcuts
  5820. var X = this._X;
  5821. var C = this._C;
  5822. // Save old counter values
  5823. for (var i = 0; i < 8; i++) {
  5824. C_[i] = C[i];
  5825. }
  5826. // Calculate new counter values
  5827. C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
  5828. C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
  5829. C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
  5830. C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
  5831. C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
  5832. C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
  5833. C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
  5834. C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
  5835. this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
  5836. // Calculate the g-values
  5837. for (var i = 0; i < 8; i++) {
  5838. var gx = X[i] + C[i];
  5839. // Construct high and low argument for squaring
  5840. var ga = gx & 0xffff;
  5841. var gb = gx >>> 16;
  5842. // Calculate high and low result of squaring
  5843. var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
  5844. var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
  5845. // High XOR low
  5846. G[i] = gh ^ gl;
  5847. }
  5848. // Calculate new state values
  5849. X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
  5850. X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
  5851. X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
  5852. X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
  5853. X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
  5854. X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
  5855. X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
  5856. X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
  5857. }
  5858. /**
  5859. * Shortcut functions to the cipher's object interface.
  5860. *
  5861. * @example
  5862. *
  5863. * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);
  5864. * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);
  5865. */
  5866. C.Rabbit = StreamCipher._createHelper(Rabbit);
  5867. }());
  5868. return CryptoJS.Rabbit;
  5869. }));
  5870. }, function(modId) { var map = {"./core":1733984946567,"./enc-base64":1733984946571,"./md5":1733984946573,"./evpkdf":1733984946583,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  5871. __DEFINE__(1733984946600, function(require, module, exports) {
  5872. ;(function (root, factory, undef) {
  5873. if (typeof exports === "object") {
  5874. // CommonJS
  5875. module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
  5876. }
  5877. else if (typeof define === "function" && define.amd) {
  5878. // AMD
  5879. define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
  5880. }
  5881. else {
  5882. // Global (browser)
  5883. factory(root.CryptoJS);
  5884. }
  5885. }(this, function (CryptoJS) {
  5886. (function () {
  5887. // Shortcuts
  5888. var C = CryptoJS;
  5889. var C_lib = C.lib;
  5890. var StreamCipher = C_lib.StreamCipher;
  5891. var C_algo = C.algo;
  5892. // Reusable objects
  5893. var S = [];
  5894. var C_ = [];
  5895. var G = [];
  5896. /**
  5897. * Rabbit stream cipher algorithm.
  5898. *
  5899. * This is a legacy version that neglected to convert the key to little-endian.
  5900. * This error doesn't affect the cipher's security,
  5901. * but it does affect its compatibility with other implementations.
  5902. */
  5903. var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({
  5904. _doReset: function () {
  5905. // Shortcuts
  5906. var K = this._key.words;
  5907. var iv = this.cfg.iv;
  5908. // Generate initial state values
  5909. var X = this._X = [
  5910. K[0], (K[3] << 16) | (K[2] >>> 16),
  5911. K[1], (K[0] << 16) | (K[3] >>> 16),
  5912. K[2], (K[1] << 16) | (K[0] >>> 16),
  5913. K[3], (K[2] << 16) | (K[1] >>> 16)
  5914. ];
  5915. // Generate initial counter values
  5916. var C = this._C = [
  5917. (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
  5918. (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
  5919. (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
  5920. (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
  5921. ];
  5922. // Carry bit
  5923. this._b = 0;
  5924. // Iterate the system four times
  5925. for (var i = 0; i < 4; i++) {
  5926. nextState.call(this);
  5927. }
  5928. // Modify the counters
  5929. for (var i = 0; i < 8; i++) {
  5930. C[i] ^= X[(i + 4) & 7];
  5931. }
  5932. // IV setup
  5933. if (iv) {
  5934. // Shortcuts
  5935. var IV = iv.words;
  5936. var IV_0 = IV[0];
  5937. var IV_1 = IV[1];
  5938. // Generate four subvectors
  5939. var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
  5940. var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
  5941. var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
  5942. var i3 = (i2 << 16) | (i0 & 0x0000ffff);
  5943. // Modify counter values
  5944. C[0] ^= i0;
  5945. C[1] ^= i1;
  5946. C[2] ^= i2;
  5947. C[3] ^= i3;
  5948. C[4] ^= i0;
  5949. C[5] ^= i1;
  5950. C[6] ^= i2;
  5951. C[7] ^= i3;
  5952. // Iterate the system four times
  5953. for (var i = 0; i < 4; i++) {
  5954. nextState.call(this);
  5955. }
  5956. }
  5957. },
  5958. _doProcessBlock: function (M, offset) {
  5959. // Shortcut
  5960. var X = this._X;
  5961. // Iterate the system
  5962. nextState.call(this);
  5963. // Generate four keystream words
  5964. S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
  5965. S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
  5966. S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
  5967. S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
  5968. for (var i = 0; i < 4; i++) {
  5969. // Swap endian
  5970. S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
  5971. (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
  5972. // Encrypt
  5973. M[offset + i] ^= S[i];
  5974. }
  5975. },
  5976. blockSize: 128/32,
  5977. ivSize: 64/32
  5978. });
  5979. function nextState() {
  5980. // Shortcuts
  5981. var X = this._X;
  5982. var C = this._C;
  5983. // Save old counter values
  5984. for (var i = 0; i < 8; i++) {
  5985. C_[i] = C[i];
  5986. }
  5987. // Calculate new counter values
  5988. C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
  5989. C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
  5990. C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
  5991. C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
  5992. C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
  5993. C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
  5994. C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
  5995. C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
  5996. this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
  5997. // Calculate the g-values
  5998. for (var i = 0; i < 8; i++) {
  5999. var gx = X[i] + C[i];
  6000. // Construct high and low argument for squaring
  6001. var ga = gx & 0xffff;
  6002. var gb = gx >>> 16;
  6003. // Calculate high and low result of squaring
  6004. var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
  6005. var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
  6006. // High XOR low
  6007. G[i] = gh ^ gl;
  6008. }
  6009. // Calculate new state values
  6010. X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
  6011. X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
  6012. X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
  6013. X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
  6014. X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
  6015. X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
  6016. X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
  6017. X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
  6018. }
  6019. /**
  6020. * Shortcut functions to the cipher's object interface.
  6021. *
  6022. * @example
  6023. *
  6024. * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg);
  6025. * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);
  6026. */
  6027. C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy);
  6028. }());
  6029. return CryptoJS.RabbitLegacy;
  6030. }));
  6031. }, function(modId) { var map = {"./core":1733984946567,"./enc-base64":1733984946571,"./md5":1733984946573,"./evpkdf":1733984946583,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  6032. __DEFINE__(1733984946601, function(require, module, exports) {
  6033. ;(function (root, factory, undef) {
  6034. if (typeof exports === "object") {
  6035. // CommonJS
  6036. module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
  6037. }
  6038. else if (typeof define === "function" && define.amd) {
  6039. // AMD
  6040. define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
  6041. }
  6042. else {
  6043. // Global (browser)
  6044. factory(root.CryptoJS);
  6045. }
  6046. }(this, function (CryptoJS) {
  6047. (function () {
  6048. // Shortcuts
  6049. var C = CryptoJS;
  6050. var C_lib = C.lib;
  6051. var BlockCipher = C_lib.BlockCipher;
  6052. var C_algo = C.algo;
  6053. const N = 16;
  6054. //Origin pbox and sbox, derived from PI
  6055. const ORIG_P = [
  6056. 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,
  6057. 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89,
  6058. 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C,
  6059. 0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917,
  6060. 0x9216D5D9, 0x8979FB1B
  6061. ];
  6062. const ORIG_S = [
  6063. [ 0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7,
  6064. 0xB8E1AFED, 0x6A267E96, 0xBA7C9045, 0xF12C7F99,
  6065. 0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16,
  6066. 0x636920D8, 0x71574E69, 0xA458FEA3, 0xF4933D7E,
  6067. 0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE,
  6068. 0x7B54A41D, 0xC25A59B5, 0x9C30D539, 0x2AF26013,
  6069. 0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF,
  6070. 0x8E79DCB0, 0x603A180E, 0x6C9E0E8B, 0xB01E8A3E,
  6071. 0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60,
  6072. 0xE65525F3, 0xAA55AB94, 0x57489862, 0x63E81440,
  6073. 0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE,
  6074. 0xA15486AF, 0x7C72E993, 0xB3EE1411, 0x636FBC2A,
  6075. 0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E,
  6076. 0xAFD6BA33, 0x6C24CF5C, 0x7A325381, 0x28958677,
  6077. 0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193,
  6078. 0x61D809CC, 0xFB21A991, 0x487CAC60, 0x5DEC8032,
  6079. 0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88,
  6080. 0x23893E81, 0xD396ACC5, 0x0F6D6FF3, 0x83F44239,
  6081. 0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E,
  6082. 0x21C66842, 0xF6E96C9A, 0x670C9C61, 0xABD388F0,
  6083. 0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3,
  6084. 0x6EEF0B6C, 0x137A3BE4, 0xBA3BF050, 0x7EFB2A98,
  6085. 0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88,
  6086. 0x8CEE8619, 0x456F9FB4, 0x7D84A5C3, 0x3B8B5EBE,
  6087. 0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6,
  6088. 0x4ED3AA62, 0x363F7706, 0x1BFEDF72, 0x429B023D,
  6089. 0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B,
  6090. 0x075372C9, 0x80991B7B, 0x25D479D8, 0xF6E8DEF7,
  6091. 0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA,
  6092. 0xC1A94FB6, 0x409F60C4, 0x5E5C9EC2, 0x196A2463,
  6093. 0x68FB6FAF, 0x3E6C53B5, 0x1339B2EB, 0x3B52EC6F,
  6094. 0x6DFC511F, 0x9B30952C, 0xCC814544, 0xAF5EBD09,
  6095. 0xBEE3D004, 0xDE334AFD, 0x660F2807, 0x192E4BB3,
  6096. 0xC0CBA857, 0x45C8740F, 0xD20B5F39, 0xB9D3FBDB,
  6097. 0x5579C0BD, 0x1A60320A, 0xD6A100C6, 0x402C7279,
  6098. 0x679F25FE, 0xFB1FA3CC, 0x8EA5E9F8, 0xDB3222F8,
  6099. 0x3C7516DF, 0xFD616B15, 0x2F501EC8, 0xAD0552AB,
  6100. 0x323DB5FA, 0xFD238760, 0x53317B48, 0x3E00DF82,
  6101. 0x9E5C57BB, 0xCA6F8CA0, 0x1A87562E, 0xDF1769DB,
  6102. 0xD542A8F6, 0x287EFFC3, 0xAC6732C6, 0x8C4F5573,
  6103. 0x695B27B0, 0xBBCA58C8, 0xE1FFA35D, 0xB8F011A0,
  6104. 0x10FA3D98, 0xFD2183B8, 0x4AFCB56C, 0x2DD1D35B,
  6105. 0x9A53E479, 0xB6F84565, 0xD28E49BC, 0x4BFB9790,
  6106. 0xE1DDF2DA, 0xA4CB7E33, 0x62FB1341, 0xCEE4C6E8,
  6107. 0xEF20CADA, 0x36774C01, 0xD07E9EFE, 0x2BF11FB4,
  6108. 0x95DBDA4D, 0xAE909198, 0xEAAD8E71, 0x6B93D5A0,
  6109. 0xD08ED1D0, 0xAFC725E0, 0x8E3C5B2F, 0x8E7594B7,
  6110. 0x8FF6E2FB, 0xF2122B64, 0x8888B812, 0x900DF01C,
  6111. 0x4FAD5EA0, 0x688FC31C, 0xD1CFF191, 0xB3A8C1AD,
  6112. 0x2F2F2218, 0xBE0E1777, 0xEA752DFE, 0x8B021FA1,
  6113. 0xE5A0CC0F, 0xB56F74E8, 0x18ACF3D6, 0xCE89E299,
  6114. 0xB4A84FE0, 0xFD13E0B7, 0x7CC43B81, 0xD2ADA8D9,
  6115. 0x165FA266, 0x80957705, 0x93CC7314, 0x211A1477,
  6116. 0xE6AD2065, 0x77B5FA86, 0xC75442F5, 0xFB9D35CF,
  6117. 0xEBCDAF0C, 0x7B3E89A0, 0xD6411BD3, 0xAE1E7E49,
  6118. 0x00250E2D, 0x2071B35E, 0x226800BB, 0x57B8E0AF,
  6119. 0x2464369B, 0xF009B91E, 0x5563911D, 0x59DFA6AA,
  6120. 0x78C14389, 0xD95A537F, 0x207D5BA2, 0x02E5B9C5,
  6121. 0x83260376, 0x6295CFA9, 0x11C81968, 0x4E734A41,
  6122. 0xB3472DCA, 0x7B14A94A, 0x1B510052, 0x9A532915,
  6123. 0xD60F573F, 0xBC9BC6E4, 0x2B60A476, 0x81E67400,
  6124. 0x08BA6FB5, 0x571BE91F, 0xF296EC6B, 0x2A0DD915,
  6125. 0xB6636521, 0xE7B9F9B6, 0xFF34052E, 0xC5855664,
  6126. 0x53B02D5D, 0xA99F8FA1, 0x08BA4799, 0x6E85076A ],
  6127. [ 0x4B7A70E9, 0xB5B32944, 0xDB75092E, 0xC4192623,
  6128. 0xAD6EA6B0, 0x49A7DF7D, 0x9CEE60B8, 0x8FEDB266,
  6129. 0xECAA8C71, 0x699A17FF, 0x5664526C, 0xC2B19EE1,
  6130. 0x193602A5, 0x75094C29, 0xA0591340, 0xE4183A3E,
  6131. 0x3F54989A, 0x5B429D65, 0x6B8FE4D6, 0x99F73FD6,
  6132. 0xA1D29C07, 0xEFE830F5, 0x4D2D38E6, 0xF0255DC1,
  6133. 0x4CDD2086, 0x8470EB26, 0x6382E9C6, 0x021ECC5E,
  6134. 0x09686B3F, 0x3EBAEFC9, 0x3C971814, 0x6B6A70A1,
  6135. 0x687F3584, 0x52A0E286, 0xB79C5305, 0xAA500737,
  6136. 0x3E07841C, 0x7FDEAE5C, 0x8E7D44EC, 0x5716F2B8,
  6137. 0xB03ADA37, 0xF0500C0D, 0xF01C1F04, 0x0200B3FF,
  6138. 0xAE0CF51A, 0x3CB574B2, 0x25837A58, 0xDC0921BD,
  6139. 0xD19113F9, 0x7CA92FF6, 0x94324773, 0x22F54701,
  6140. 0x3AE5E581, 0x37C2DADC, 0xC8B57634, 0x9AF3DDA7,
  6141. 0xA9446146, 0x0FD0030E, 0xECC8C73E, 0xA4751E41,
  6142. 0xE238CD99, 0x3BEA0E2F, 0x3280BBA1, 0x183EB331,
  6143. 0x4E548B38, 0x4F6DB908, 0x6F420D03, 0xF60A04BF,
  6144. 0x2CB81290, 0x24977C79, 0x5679B072, 0xBCAF89AF,
  6145. 0xDE9A771F, 0xD9930810, 0xB38BAE12, 0xDCCF3F2E,
  6146. 0x5512721F, 0x2E6B7124, 0x501ADDE6, 0x9F84CD87,
  6147. 0x7A584718, 0x7408DA17, 0xBC9F9ABC, 0xE94B7D8C,
  6148. 0xEC7AEC3A, 0xDB851DFA, 0x63094366, 0xC464C3D2,
  6149. 0xEF1C1847, 0x3215D908, 0xDD433B37, 0x24C2BA16,
  6150. 0x12A14D43, 0x2A65C451, 0x50940002, 0x133AE4DD,
  6151. 0x71DFF89E, 0x10314E55, 0x81AC77D6, 0x5F11199B,
  6152. 0x043556F1, 0xD7A3C76B, 0x3C11183B, 0x5924A509,
  6153. 0xF28FE6ED, 0x97F1FBFA, 0x9EBABF2C, 0x1E153C6E,
  6154. 0x86E34570, 0xEAE96FB1, 0x860E5E0A, 0x5A3E2AB3,
  6155. 0x771FE71C, 0x4E3D06FA, 0x2965DCB9, 0x99E71D0F,
  6156. 0x803E89D6, 0x5266C825, 0x2E4CC978, 0x9C10B36A,
  6157. 0xC6150EBA, 0x94E2EA78, 0xA5FC3C53, 0x1E0A2DF4,
  6158. 0xF2F74EA7, 0x361D2B3D, 0x1939260F, 0x19C27960,
  6159. 0x5223A708, 0xF71312B6, 0xEBADFE6E, 0xEAC31F66,
  6160. 0xE3BC4595, 0xA67BC883, 0xB17F37D1, 0x018CFF28,
  6161. 0xC332DDEF, 0xBE6C5AA5, 0x65582185, 0x68AB9802,
  6162. 0xEECEA50F, 0xDB2F953B, 0x2AEF7DAD, 0x5B6E2F84,
  6163. 0x1521B628, 0x29076170, 0xECDD4775, 0x619F1510,
  6164. 0x13CCA830, 0xEB61BD96, 0x0334FE1E, 0xAA0363CF,
  6165. 0xB5735C90, 0x4C70A239, 0xD59E9E0B, 0xCBAADE14,
  6166. 0xEECC86BC, 0x60622CA7, 0x9CAB5CAB, 0xB2F3846E,
  6167. 0x648B1EAF, 0x19BDF0CA, 0xA02369B9, 0x655ABB50,
  6168. 0x40685A32, 0x3C2AB4B3, 0x319EE9D5, 0xC021B8F7,
  6169. 0x9B540B19, 0x875FA099, 0x95F7997E, 0x623D7DA8,
  6170. 0xF837889A, 0x97E32D77, 0x11ED935F, 0x16681281,
  6171. 0x0E358829, 0xC7E61FD6, 0x96DEDFA1, 0x7858BA99,
  6172. 0x57F584A5, 0x1B227263, 0x9B83C3FF, 0x1AC24696,
  6173. 0xCDB30AEB, 0x532E3054, 0x8FD948E4, 0x6DBC3128,
  6174. 0x58EBF2EF, 0x34C6FFEA, 0xFE28ED61, 0xEE7C3C73,
  6175. 0x5D4A14D9, 0xE864B7E3, 0x42105D14, 0x203E13E0,
  6176. 0x45EEE2B6, 0xA3AAABEA, 0xDB6C4F15, 0xFACB4FD0,
  6177. 0xC742F442, 0xEF6ABBB5, 0x654F3B1D, 0x41CD2105,
  6178. 0xD81E799E, 0x86854DC7, 0xE44B476A, 0x3D816250,
  6179. 0xCF62A1F2, 0x5B8D2646, 0xFC8883A0, 0xC1C7B6A3,
  6180. 0x7F1524C3, 0x69CB7492, 0x47848A0B, 0x5692B285,
  6181. 0x095BBF00, 0xAD19489D, 0x1462B174, 0x23820E00,
  6182. 0x58428D2A, 0x0C55F5EA, 0x1DADF43E, 0x233F7061,
  6183. 0x3372F092, 0x8D937E41, 0xD65FECF1, 0x6C223BDB,
  6184. 0x7CDE3759, 0xCBEE7460, 0x4085F2A7, 0xCE77326E,
  6185. 0xA6078084, 0x19F8509E, 0xE8EFD855, 0x61D99735,
  6186. 0xA969A7AA, 0xC50C06C2, 0x5A04ABFC, 0x800BCADC,
  6187. 0x9E447A2E, 0xC3453484, 0xFDD56705, 0x0E1E9EC9,
  6188. 0xDB73DBD3, 0x105588CD, 0x675FDA79, 0xE3674340,
  6189. 0xC5C43465, 0x713E38D8, 0x3D28F89E, 0xF16DFF20,
  6190. 0x153E21E7, 0x8FB03D4A, 0xE6E39F2B, 0xDB83ADF7 ],
  6191. [ 0xE93D5A68, 0x948140F7, 0xF64C261C, 0x94692934,
  6192. 0x411520F7, 0x7602D4F7, 0xBCF46B2E, 0xD4A20068,
  6193. 0xD4082471, 0x3320F46A, 0x43B7D4B7, 0x500061AF,
  6194. 0x1E39F62E, 0x97244546, 0x14214F74, 0xBF8B8840,
  6195. 0x4D95FC1D, 0x96B591AF, 0x70F4DDD3, 0x66A02F45,
  6196. 0xBFBC09EC, 0x03BD9785, 0x7FAC6DD0, 0x31CB8504,
  6197. 0x96EB27B3, 0x55FD3941, 0xDA2547E6, 0xABCA0A9A,
  6198. 0x28507825, 0x530429F4, 0x0A2C86DA, 0xE9B66DFB,
  6199. 0x68DC1462, 0xD7486900, 0x680EC0A4, 0x27A18DEE,
  6200. 0x4F3FFEA2, 0xE887AD8C, 0xB58CE006, 0x7AF4D6B6,
  6201. 0xAACE1E7C, 0xD3375FEC, 0xCE78A399, 0x406B2A42,
  6202. 0x20FE9E35, 0xD9F385B9, 0xEE39D7AB, 0x3B124E8B,
  6203. 0x1DC9FAF7, 0x4B6D1856, 0x26A36631, 0xEAE397B2,
  6204. 0x3A6EFA74, 0xDD5B4332, 0x6841E7F7, 0xCA7820FB,
  6205. 0xFB0AF54E, 0xD8FEB397, 0x454056AC, 0xBA489527,
  6206. 0x55533A3A, 0x20838D87, 0xFE6BA9B7, 0xD096954B,
  6207. 0x55A867BC, 0xA1159A58, 0xCCA92963, 0x99E1DB33,
  6208. 0xA62A4A56, 0x3F3125F9, 0x5EF47E1C, 0x9029317C,
  6209. 0xFDF8E802, 0x04272F70, 0x80BB155C, 0x05282CE3,
  6210. 0x95C11548, 0xE4C66D22, 0x48C1133F, 0xC70F86DC,
  6211. 0x07F9C9EE, 0x41041F0F, 0x404779A4, 0x5D886E17,
  6212. 0x325F51EB, 0xD59BC0D1, 0xF2BCC18F, 0x41113564,
  6213. 0x257B7834, 0x602A9C60, 0xDFF8E8A3, 0x1F636C1B,
  6214. 0x0E12B4C2, 0x02E1329E, 0xAF664FD1, 0xCAD18115,
  6215. 0x6B2395E0, 0x333E92E1, 0x3B240B62, 0xEEBEB922,
  6216. 0x85B2A20E, 0xE6BA0D99, 0xDE720C8C, 0x2DA2F728,
  6217. 0xD0127845, 0x95B794FD, 0x647D0862, 0xE7CCF5F0,
  6218. 0x5449A36F, 0x877D48FA, 0xC39DFD27, 0xF33E8D1E,
  6219. 0x0A476341, 0x992EFF74, 0x3A6F6EAB, 0xF4F8FD37,
  6220. 0xA812DC60, 0xA1EBDDF8, 0x991BE14C, 0xDB6E6B0D,
  6221. 0xC67B5510, 0x6D672C37, 0x2765D43B, 0xDCD0E804,
  6222. 0xF1290DC7, 0xCC00FFA3, 0xB5390F92, 0x690FED0B,
  6223. 0x667B9FFB, 0xCEDB7D9C, 0xA091CF0B, 0xD9155EA3,
  6224. 0xBB132F88, 0x515BAD24, 0x7B9479BF, 0x763BD6EB,
  6225. 0x37392EB3, 0xCC115979, 0x8026E297, 0xF42E312D,
  6226. 0x6842ADA7, 0xC66A2B3B, 0x12754CCC, 0x782EF11C,
  6227. 0x6A124237, 0xB79251E7, 0x06A1BBE6, 0x4BFB6350,
  6228. 0x1A6B1018, 0x11CAEDFA, 0x3D25BDD8, 0xE2E1C3C9,
  6229. 0x44421659, 0x0A121386, 0xD90CEC6E, 0xD5ABEA2A,
  6230. 0x64AF674E, 0xDA86A85F, 0xBEBFE988, 0x64E4C3FE,
  6231. 0x9DBC8057, 0xF0F7C086, 0x60787BF8, 0x6003604D,
  6232. 0xD1FD8346, 0xF6381FB0, 0x7745AE04, 0xD736FCCC,
  6233. 0x83426B33, 0xF01EAB71, 0xB0804187, 0x3C005E5F,
  6234. 0x77A057BE, 0xBDE8AE24, 0x55464299, 0xBF582E61,
  6235. 0x4E58F48F, 0xF2DDFDA2, 0xF474EF38, 0x8789BDC2,
  6236. 0x5366F9C3, 0xC8B38E74, 0xB475F255, 0x46FCD9B9,
  6237. 0x7AEB2661, 0x8B1DDF84, 0x846A0E79, 0x915F95E2,
  6238. 0x466E598E, 0x20B45770, 0x8CD55591, 0xC902DE4C,
  6239. 0xB90BACE1, 0xBB8205D0, 0x11A86248, 0x7574A99E,
  6240. 0xB77F19B6, 0xE0A9DC09, 0x662D09A1, 0xC4324633,
  6241. 0xE85A1F02, 0x09F0BE8C, 0x4A99A025, 0x1D6EFE10,
  6242. 0x1AB93D1D, 0x0BA5A4DF, 0xA186F20F, 0x2868F169,
  6243. 0xDCB7DA83, 0x573906FE, 0xA1E2CE9B, 0x4FCD7F52,
  6244. 0x50115E01, 0xA70683FA, 0xA002B5C4, 0x0DE6D027,
  6245. 0x9AF88C27, 0x773F8641, 0xC3604C06, 0x61A806B5,
  6246. 0xF0177A28, 0xC0F586E0, 0x006058AA, 0x30DC7D62,
  6247. 0x11E69ED7, 0x2338EA63, 0x53C2DD94, 0xC2C21634,
  6248. 0xBBCBEE56, 0x90BCB6DE, 0xEBFC7DA1, 0xCE591D76,
  6249. 0x6F05E409, 0x4B7C0188, 0x39720A3D, 0x7C927C24,
  6250. 0x86E3725F, 0x724D9DB9, 0x1AC15BB4, 0xD39EB8FC,
  6251. 0xED545578, 0x08FCA5B5, 0xD83D7CD3, 0x4DAD0FC4,
  6252. 0x1E50EF5E, 0xB161E6F8, 0xA28514D9, 0x6C51133C,
  6253. 0x6FD5C7E7, 0x56E14EC4, 0x362ABFCE, 0xDDC6C837,
  6254. 0xD79A3234, 0x92638212, 0x670EFA8E, 0x406000E0 ],
  6255. [ 0x3A39CE37, 0xD3FAF5CF, 0xABC27737, 0x5AC52D1B,
  6256. 0x5CB0679E, 0x4FA33742, 0xD3822740, 0x99BC9BBE,
  6257. 0xD5118E9D, 0xBF0F7315, 0xD62D1C7E, 0xC700C47B,
  6258. 0xB78C1B6B, 0x21A19045, 0xB26EB1BE, 0x6A366EB4,
  6259. 0x5748AB2F, 0xBC946E79, 0xC6A376D2, 0x6549C2C8,
  6260. 0x530FF8EE, 0x468DDE7D, 0xD5730A1D, 0x4CD04DC6,
  6261. 0x2939BBDB, 0xA9BA4650, 0xAC9526E8, 0xBE5EE304,
  6262. 0xA1FAD5F0, 0x6A2D519A, 0x63EF8CE2, 0x9A86EE22,
  6263. 0xC089C2B8, 0x43242EF6, 0xA51E03AA, 0x9CF2D0A4,
  6264. 0x83C061BA, 0x9BE96A4D, 0x8FE51550, 0xBA645BD6,
  6265. 0x2826A2F9, 0xA73A3AE1, 0x4BA99586, 0xEF5562E9,
  6266. 0xC72FEFD3, 0xF752F7DA, 0x3F046F69, 0x77FA0A59,
  6267. 0x80E4A915, 0x87B08601, 0x9B09E6AD, 0x3B3EE593,
  6268. 0xE990FD5A, 0x9E34D797, 0x2CF0B7D9, 0x022B8B51,
  6269. 0x96D5AC3A, 0x017DA67D, 0xD1CF3ED6, 0x7C7D2D28,
  6270. 0x1F9F25CF, 0xADF2B89B, 0x5AD6B472, 0x5A88F54C,
  6271. 0xE029AC71, 0xE019A5E6, 0x47B0ACFD, 0xED93FA9B,
  6272. 0xE8D3C48D, 0x283B57CC, 0xF8D56629, 0x79132E28,
  6273. 0x785F0191, 0xED756055, 0xF7960E44, 0xE3D35E8C,
  6274. 0x15056DD4, 0x88F46DBA, 0x03A16125, 0x0564F0BD,
  6275. 0xC3EB9E15, 0x3C9057A2, 0x97271AEC, 0xA93A072A,
  6276. 0x1B3F6D9B, 0x1E6321F5, 0xF59C66FB, 0x26DCF319,
  6277. 0x7533D928, 0xB155FDF5, 0x03563482, 0x8ABA3CBB,
  6278. 0x28517711, 0xC20AD9F8, 0xABCC5167, 0xCCAD925F,
  6279. 0x4DE81751, 0x3830DC8E, 0x379D5862, 0x9320F991,
  6280. 0xEA7A90C2, 0xFB3E7BCE, 0x5121CE64, 0x774FBE32,
  6281. 0xA8B6E37E, 0xC3293D46, 0x48DE5369, 0x6413E680,
  6282. 0xA2AE0810, 0xDD6DB224, 0x69852DFD, 0x09072166,
  6283. 0xB39A460A, 0x6445C0DD, 0x586CDECF, 0x1C20C8AE,
  6284. 0x5BBEF7DD, 0x1B588D40, 0xCCD2017F, 0x6BB4E3BB,
  6285. 0xDDA26A7E, 0x3A59FF45, 0x3E350A44, 0xBCB4CDD5,
  6286. 0x72EACEA8, 0xFA6484BB, 0x8D6612AE, 0xBF3C6F47,
  6287. 0xD29BE463, 0x542F5D9E, 0xAEC2771B, 0xF64E6370,
  6288. 0x740E0D8D, 0xE75B1357, 0xF8721671, 0xAF537D5D,
  6289. 0x4040CB08, 0x4EB4E2CC, 0x34D2466A, 0x0115AF84,
  6290. 0xE1B00428, 0x95983A1D, 0x06B89FB4, 0xCE6EA048,
  6291. 0x6F3F3B82, 0x3520AB82, 0x011A1D4B, 0x277227F8,
  6292. 0x611560B1, 0xE7933FDC, 0xBB3A792B, 0x344525BD,
  6293. 0xA08839E1, 0x51CE794B, 0x2F32C9B7, 0xA01FBAC9,
  6294. 0xE01CC87E, 0xBCC7D1F6, 0xCF0111C3, 0xA1E8AAC7,
  6295. 0x1A908749, 0xD44FBD9A, 0xD0DADECB, 0xD50ADA38,
  6296. 0x0339C32A, 0xC6913667, 0x8DF9317C, 0xE0B12B4F,
  6297. 0xF79E59B7, 0x43F5BB3A, 0xF2D519FF, 0x27D9459C,
  6298. 0xBF97222C, 0x15E6FC2A, 0x0F91FC71, 0x9B941525,
  6299. 0xFAE59361, 0xCEB69CEB, 0xC2A86459, 0x12BAA8D1,
  6300. 0xB6C1075E, 0xE3056A0C, 0x10D25065, 0xCB03A442,
  6301. 0xE0EC6E0E, 0x1698DB3B, 0x4C98A0BE, 0x3278E964,
  6302. 0x9F1F9532, 0xE0D392DF, 0xD3A0342B, 0x8971F21E,
  6303. 0x1B0A7441, 0x4BA3348C, 0xC5BE7120, 0xC37632D8,
  6304. 0xDF359F8D, 0x9B992F2E, 0xE60B6F47, 0x0FE3F11D,
  6305. 0xE54CDA54, 0x1EDAD891, 0xCE6279CF, 0xCD3E7E6F,
  6306. 0x1618B166, 0xFD2C1D05, 0x848FD2C5, 0xF6FB2299,
  6307. 0xF523F357, 0xA6327623, 0x93A83531, 0x56CCCD02,
  6308. 0xACF08162, 0x5A75EBB5, 0x6E163697, 0x88D273CC,
  6309. 0xDE966292, 0x81B949D0, 0x4C50901B, 0x71C65614,
  6310. 0xE6C6C7BD, 0x327A140A, 0x45E1D006, 0xC3F27B9A,
  6311. 0xC9AA53FD, 0x62A80F00, 0xBB25BFE2, 0x35BDD2F6,
  6312. 0x71126905, 0xB2040222, 0xB6CBCF7C, 0xCD769C2B,
  6313. 0x53113EC0, 0x1640E3D3, 0x38ABBD60, 0x2547ADF0,
  6314. 0xBA38209C, 0xF746CE76, 0x77AFA1C5, 0x20756060,
  6315. 0x85CBFE4E, 0x8AE88DD8, 0x7AAAF9B0, 0x4CF9AA7E,
  6316. 0x1948C25C, 0x02FB8A8C, 0x01C36AE4, 0xD6EBE1F9,
  6317. 0x90D4F869, 0xA65CDEA0, 0x3F09252D, 0xC208E69F,
  6318. 0xB74E6132, 0xCE77E25B, 0x578FDFE3, 0x3AC372E6 ]
  6319. ];
  6320. var BLOWFISH_CTX = {
  6321. pbox: [],
  6322. sbox: []
  6323. }
  6324. function F(ctx, x){
  6325. let a = (x >> 24) & 0xFF;
  6326. let b = (x >> 16) & 0xFF;
  6327. let c = (x >> 8) & 0xFF;
  6328. let d = x & 0xFF;
  6329. let y = ctx.sbox[0][a] + ctx.sbox[1][b];
  6330. y = y ^ ctx.sbox[2][c];
  6331. y = y + ctx.sbox[3][d];
  6332. return y;
  6333. }
  6334. function BlowFish_Encrypt(ctx, left, right){
  6335. let Xl = left;
  6336. let Xr = right;
  6337. let temp;
  6338. for(let i = 0; i < N; ++i){
  6339. Xl = Xl ^ ctx.pbox[i];
  6340. Xr = F(ctx, Xl) ^ Xr;
  6341. temp = Xl;
  6342. Xl = Xr;
  6343. Xr = temp;
  6344. }
  6345. temp = Xl;
  6346. Xl = Xr;
  6347. Xr = temp;
  6348. Xr = Xr ^ ctx.pbox[N];
  6349. Xl = Xl ^ ctx.pbox[N + 1];
  6350. return {left: Xl, right: Xr};
  6351. }
  6352. function BlowFish_Decrypt(ctx, left, right){
  6353. let Xl = left;
  6354. let Xr = right;
  6355. let temp;
  6356. for(let i = N + 1; i > 1; --i){
  6357. Xl = Xl ^ ctx.pbox[i];
  6358. Xr = F(ctx, Xl) ^ Xr;
  6359. temp = Xl;
  6360. Xl = Xr;
  6361. Xr = temp;
  6362. }
  6363. temp = Xl;
  6364. Xl = Xr;
  6365. Xr = temp;
  6366. Xr = Xr ^ ctx.pbox[1];
  6367. Xl = Xl ^ ctx.pbox[0];
  6368. return {left: Xl, right: Xr};
  6369. }
  6370. /**
  6371. * Initialization ctx's pbox and sbox.
  6372. *
  6373. * @param {Object} ctx The object has pbox and sbox.
  6374. * @param {Array} key An array of 32-bit words.
  6375. * @param {int} keysize The length of the key.
  6376. *
  6377. * @example
  6378. *
  6379. * BlowFishInit(BLOWFISH_CTX, key, 128/32);
  6380. */
  6381. function BlowFishInit(ctx, key, keysize)
  6382. {
  6383. for(let Row = 0; Row < 4; Row++)
  6384. {
  6385. ctx.sbox[Row] = [];
  6386. for(let Col = 0; Col < 256; Col++)
  6387. {
  6388. ctx.sbox[Row][Col] = ORIG_S[Row][Col];
  6389. }
  6390. }
  6391. let keyIndex = 0;
  6392. for(let index = 0; index < N + 2; index++)
  6393. {
  6394. ctx.pbox[index] = ORIG_P[index] ^ key[keyIndex];
  6395. keyIndex++;
  6396. if(keyIndex >= keysize)
  6397. {
  6398. keyIndex = 0;
  6399. }
  6400. }
  6401. let Data1 = 0;
  6402. let Data2 = 0;
  6403. let res = 0;
  6404. for(let i = 0; i < N + 2; i += 2)
  6405. {
  6406. res = BlowFish_Encrypt(ctx, Data1, Data2);
  6407. Data1 = res.left;
  6408. Data2 = res.right;
  6409. ctx.pbox[i] = Data1;
  6410. ctx.pbox[i + 1] = Data2;
  6411. }
  6412. for(let i = 0; i < 4; i++)
  6413. {
  6414. for(let j = 0; j < 256; j += 2)
  6415. {
  6416. res = BlowFish_Encrypt(ctx, Data1, Data2);
  6417. Data1 = res.left;
  6418. Data2 = res.right;
  6419. ctx.sbox[i][j] = Data1;
  6420. ctx.sbox[i][j + 1] = Data2;
  6421. }
  6422. }
  6423. return true;
  6424. }
  6425. /**
  6426. * Blowfish block cipher algorithm.
  6427. */
  6428. var Blowfish = C_algo.Blowfish = BlockCipher.extend({
  6429. _doReset: function () {
  6430. // Skip reset of nRounds has been set before and key did not change
  6431. if (this._keyPriorReset === this._key) {
  6432. return;
  6433. }
  6434. // Shortcuts
  6435. var key = this._keyPriorReset = this._key;
  6436. var keyWords = key.words;
  6437. var keySize = key.sigBytes / 4;
  6438. //Initialization pbox and sbox
  6439. BlowFishInit(BLOWFISH_CTX, keyWords, keySize);
  6440. },
  6441. encryptBlock: function (M, offset) {
  6442. var res = BlowFish_Encrypt(BLOWFISH_CTX, M[offset], M[offset + 1]);
  6443. M[offset] = res.left;
  6444. M[offset + 1] = res.right;
  6445. },
  6446. decryptBlock: function (M, offset) {
  6447. var res = BlowFish_Decrypt(BLOWFISH_CTX, M[offset], M[offset + 1]);
  6448. M[offset] = res.left;
  6449. M[offset + 1] = res.right;
  6450. },
  6451. blockSize: 64/32,
  6452. keySize: 128/32,
  6453. ivSize: 64/32
  6454. });
  6455. /**
  6456. * Shortcut functions to the cipher's object interface.
  6457. *
  6458. * @example
  6459. *
  6460. * var ciphertext = CryptoJS.Blowfish.encrypt(message, key, cfg);
  6461. * var plaintext = CryptoJS.Blowfish.decrypt(ciphertext, key, cfg);
  6462. */
  6463. C.Blowfish = BlockCipher._createHelper(Blowfish);
  6464. }());
  6465. return CryptoJS.Blowfish;
  6466. }));
  6467. }, function(modId) { var map = {"./core":1733984946567,"./enc-base64":1733984946571,"./md5":1733984946573,"./evpkdf":1733984946583,"./cipher-core":1733984946584}; return __REQUIRE__(map[modId], modId); })
  6468. return __REQUIRE__(1733984946566);
  6469. })()
  6470. //miniprogram-npm-outsideDeps=["crypto"]
  6471. //# sourceMappingURL=index.js.map