Yesterday I saw an Eclipse plugin to register. Anti-compile. Find a registration code. But still don't understand. Found the Biginteger operation. There is also a code like M.MODPOW (D, N). No way, go on Google. Finally understand that this is the RSA algorithm.
Here is the introduction of the RSA algorithm on the Internet:
The RSA Algorithm Was Invented in 1978 By Ron Rivest, Adi Shamir, And Leonard Adleman.
Here's The Relatively Easy to Understand Math Behind Rsa Public Key Encryption.
Find P and Q, Two Large (EG, 1024-BIT) Prime Numbers. Choose E Such That E Is Greater Than 1, E IS Less Than PQ, AND E (P-1) (Q-1) Are Relatively Prime, Which Means They Have No Prime Factors in Common. E Does Not Have To Be Prime, But It Must Be Odd. (P-1) (Q-1) CAN't Be Prime Because It's An Even Number. Compute D Such That DE - 1) Is Evenly Divisible By (P-1) (Q-1). Mathematicians Write this as de = 1 (MOD (P-1) (Q-1)), and the called d the Multiplicative Inverse OF E E. THIS Is Easy to Do - SIMPLY FIND AN INTEGER X Which Causes D = (x (P-1) (Q-1) 1) / e to be an integer, Then Use That Value of D. The Encryption Function IS C = (T ^ E) mod PQ, where C is the ciphertext (a positive integer), T is the plaintext (a positive integer), and ^ indicates exponentiation. The message being encrypted, T, must be less than the modulus, PQ Decryption function is t = (c ^ d) MOD PQ, WHERE C Is The Ciphertext (a posacy integer), t is the plaintext (a posital integer), and ^ INDICATES EXPONE NTIATION.
Your public key is the pair (pq, e). Your private key is The number d. The product PQ is The MODULUS (OFTEN CALLED NIN THE LITERATURE). E Is The Public Exponent. D IS The Secret Exponent.
You Can Publish Your Public Key Freely, Because There No Known Easy Methods of Calculating D, P, OR Q Given Only (pq, e) (pq, e). IF P and q Are Each 1024 Bits Long, The Sun Will Burn Out Before The Most Powerful Computers Presently in Existence Can Factor Your Modulus Into P and q.an Example of The Rsa Algorithm
P = 61 <- First Prime Number (Destroy this After Computing E and D)
Q = 53 <- Second Prime Number (Destroy this After Computing E and D)
PQ = 3233 <- MODULUS (Give this To Others)
E = 17 <- public exponent (Give this to others)
D = 2753 <- Private Exponent (Keep this Secret!)
Your Public Key IS (E, PQ).
Your private key is d.
The Encryption Function IS:
Encrypt (t) = (t ^ e) MOD PQ
= (T ^ 17) MOD 3233
The Decryption Function IS:
Decrypt (c) = (c ^ d) MOD PQ
= (C ^ 2753) MOD 3233
To Encrypt The Plaintext Value 123, Do this:
Encrypt (123) = (123 ^ 17) MOD 3233
= 337587917446653715596592958817679803 mod 3233
= 855
To Decrypt The Ciphertext Value 855, Do this:
Decrypt (855) = (855 ^ 2753) MOD 3233
= 123
One Way to Compute The Value of 855 ^ 2753 Mod 3233 Is Like this:
2753 = 101011000001 Base 2, Therefore
2753 = 1 2 ^ 6 2 ^ 7 2 ^ 9 2 ^ 11
= 1 64 128 512 2048
Consider this Table of Powers of 855:
855 ^ 1 = 855 (MOD 3233)
855 ^ 2 = 367 (MOD 3233)
855 ^ 4 = 367 ^ 2 (MOD 3233) = 2136 (MOD 3233)
855 ^ 8 = 2136 ^ 2 (MOD 3233) = 733 (MOD 3233)
855 ^ 16 = 733 ^ 2 (MOD 3233) = 611 (MOD 3233)
855 ^ 32 = 611 ^ 2 (MOD 3233) = 1526 (MOD 3233)
855 ^ 64 = 1526 ^ 2 (MOD 3233) = 916 (MOD 3233)
855 ^ 128 = 916 ^ 2 (MOD 3233) = 1709 (MOD 3233)
855 ^ 256 = 1709 ^ 2 (MOD 3233) = 1282 (MOD 3233)
855 ^ 512 = 1282 ^ 2 (MOD 3233) = 1160 (MOD 3233)
855 ^ 1024 = 1160 ^ 2 (MOD 3233) = 672 (MOD 3233)
855 ^ 2048 = 672 ^ 2 (MOD 3233) = 2197 (MOD 3233)
Given the Above, We know this:
855 ^ 2753 (MOD 3233)
= 855 ^ (1 64 128 512 2048) (MOD 3233)
= 855 ^ 1 * 855 ^ 64 * 855 ^ 128 * 855 ^ 512 * 855 ^ 2048 (MOD 3233)
= 855 * 916 * 1709 * 1160 * 2197 (MOD 3233)
= 794 * 1709 * 1160 * 2197 (MOD 3233)
= 2319 * 1160 * 2197 (MOD 3233)
= 184 * 2197 (MOD 3233)
= 123 (MOD 3233)
= 123
If You Have a Computer Program (Such as the "BC" Utility That Comes with Linux),
You can compute 855 ^ 2753 Mod 3233 Directly, Like this:
855 ^ 2753 mod 3233
= 50432888958416068734422899127394466631453878360035509315554967564501
05562861208255997874424542811005438349865428933638493024645144150785
17209179665478263530709963803538732650089668607477182974582295034295
04079035818459409563779385865989368888888393840132509768620766977396
67533250542826093475735137988063256482639334453092594385562429233017
51977190016924916912809150591019178760171349725439279215696701789902
13430714646897127961027718137839458696772898693423652403116932170892
6961764372652131566583315871245975980304250344006837883246101784830
71758547454725206968892599589254436670143220546954317400228550092386
36942444855973333063051607385302863219302913503745471946757776713579
5496520291979050578153287155839207030315958593749366383548602090830
635507044556588963193180119341220178269233441013301164075
0469525886698765866900622402410208846650753026395387052663933584734
810948761562271260373275973603752373883641488888843888888848438096887757045380
081079469800667348289988837930703533517930705489481789773294585354474346882882463816885048824346
5889783933346625445400661945218766694795528023088412465948239275105
77049113329025684306505229256142730389832089007051511055250618994171
23177795157979429711795475296301837843862913977877661298207389072796
767202350113992715819642730764074189891904868607481245493157953743777
1244160143876506914586819640227602776686953090395114968339597324505
45234594477256587887692693353918692354818518542420923064996406822184
49011913571088542442852112077371223831105455431265307394075927890822
6060431711333957522660344516452597631618427745904320193452893299321
61307440532274705728948121435868319784155972764963570909012153570909012153570909012153570909012153570909012151333344
15756920979851832104115596935784883366531595132734467524394087576977
78908490126915322842080949630792972471304422194243906590308142893930
2915848308736874507897708692184529674114632155667865528338164806795
45594189100695091965899085456798072392370846302553545686919235546299
57157358790622745861957217211107882865756385970941907763205097832395
71346411902500470208485604082175094910771655311765297473803176765820
5876731402889103288343185088447211644271939037404115934986995913736
5162108451137402433518599576657753969362812542539006855262454561419
25880943740212888666974410972184534221817198089911953707545542033911
96453936646179296816534265223463993674233097018353390462367769367038
0534264482173582384219251590438148524738896864244388968642443703866544376153777
91396964900303958760654915244945043600135939277133952101251928572092
59788751160195962961569027116431894637342650023631004555718003693586
05526491000090724518378668956441716490727835628100970854524135469660
844811613387806548545176167829365241087238794108643482267500907782651210137281958316533969830908873174174
74535988684298559807185192215970046508106068445595364808922494405427
66329674592308898484868435865479850511542844016462352696931799377844
30217857019197098751629654665130278009966580052178208139317232379013
23249468260920081998103768484716787498919369499791482471634506093712
5654122501953795166897601855087593333677979395278295802
63122665358948205566515289466369032083287680432390611549350954590934
06676402258670848337605369986794102620470905715674470565311124286290
73548884929899835609996360921411284977458614696040287029670402878179
49024828290748416008368045866685507604619225209434980471574526881813
1850859150194852763596503458153641656549316013065493160344579651083
8030406240278898042825189094716292266898016684480963645198090510905
7965130757037924595807447975237126761011473878742144149154813591743
92799496956415653866883891715446305611805369728343470219206348999531
91764016110392490439179803398975491765395923608511807653184706473318
01578207412764787592739087492955716853665185912666373831235945891267
870958380002245150944445756487448457564874484568775308453955217306366938917023
94037184780362774643171470855830491959895146776294392143100245613061
11429937000557751339717282549110056008940898419671319709118165542908
76109008324997831338240786961578492341986299168008677495934077593066
02207814943807854996798945399364063685722697422361858411425048372451
24465580270859179795591086523099756519838277952945757865742455786888
3835444236857223681399021261363744082131478483203563615683462870198
51423901842909741638620232051039712184983355286308685184282634615027
44187358639504228151239950599598384742227777747477977774779988789721695963455346336497949221
13017661316207477266113107012321403713882270221723233085472679533015
07998062253835458948024820043144726191596190526034069061930939290724
1028494870017717296951770346790997944097506776492963567558007116218
2772760318292179035029048609097626628539668902439253689025637101471
6832740450458306022867631421581599007916426277000546123291921929971
69907690169025946468104141214204472402661658275680524168861473393322
65959127006456304474160852916721870070451446497932266687321463467490
41185886760836840306190695786990096521390675205019744076776510438851
519416193184799191349243881528220384647292694460849152999588491588555
19514906630731177723813226751694588259363878610724302565980914901032
78384821401136556784934102431512482864529170314845291703448400120163648299853
2516634905605379458508942440385525245547779244010477770752745148425252745163425
13992163738356814149047932037426337301987825405699619163520193896982
544786313097737491544784276345325939987417001345377208944
00285485000269685982644562183794116702151847721909339232185087775790
959332676311413129619398495926138987901669710810276638623676940572
95932538078643444100512138025081797622723797210352196773268441946486
16402961059899027710532570457016332634770764177743237152474626393
9901189972784536294930363691490088106050501508393380080116
6821516389310466659513782749892374556051100401647771682271626727078
370122424655126487845492350418521674263834674449039780017
84689726405462148024124125833843501704885320601475687862318094090012
63241969092252022679880113408073012216264404133887392600523096072386
1585547461979213076722454387767179755277184864847532643090938992370938053652046462
55147267884961527773274119265709116613580084145421487687310394441054
79639308530896880365608504772144592172500126500717068969428154627563
7045883890421917739819064873190801482873905815948739058159462227867277418610111
02763247972904122211994117388204526335701759090678628159281519882214
5765279685389251721872009007038913856284000733258507590485348046564
54349837073287625935891427854318266587294608072389652291599021738887
95773647738726574610400822551124182720096168188828493884678810468847
31265541726209789056784581096517975300873063154649030211213352818084
76122990409576427857316364124880930949770739567588422963371158464569
842024551090298823985179536841258914446842791897307683834073696131409
74522985638668272691043357517677128894527881368623965066654089894394
9516191200216077898876864736481837825324846699168307281220310791935
64666840159148582699993374427677252275403853322196852298590851548110
4022965791633825738513314823459591633281445819843614596306024993617
53097925561238039014690665163673718859582772525683119989984646027216
462797640770570748164064507697986995510680046471937808223250148934
07851137833251073753823403466269553292608813843895784099804170410417
77608463062862610614059615207066695243018438575031762939543026312673
7740693640470589608346260188591118436753252984588804084971092299955
655397019111919191883273086037677533960772455632113506572191067587
5118681278634419757239219526333856538388240057190102564949233944519
65959203992392217400247234147190970964562108299547746193228981181286
0555658809385189881181290561427408580916876571191124763288658712755
38928438126611991937924624112632998756524530578756577745787554001774268660965093305172102723066635739462334
136380459142377599652203094185588003949675582971125836162890148359
542349304247490536939927761142617964071001276432804287060833531594582
305946326827861270203356980346143245697021484375 MOD 3233
= 123
Find the publickey in the program, calculate the P, Q two factors with q, but my machine is too slow, for a while, I will give up.