Chapter4Cryptography:thesecretlifeofprimes
Thereaderreciatethattheofumbershas,fromtheearliesttimes,beenreizedastherepositoryofriddlesas,manyofwhieverbeehisday。Formanyofus,thisisenoughtojustifytheuedseriousstudyofhersmaytakeadifferentattitude。Intriguinganddifficultasthesesmaybe,itmightbeimagiheyhavelittlebeariofhumanwisdom。Butthatwouldbeamistake。
&helastfewdecadesithasemergedthatordihekindswealliimetotime,becodedassebers。Thishasintopradourmostprecioussecrets,whethertheybeerilitary,personalorfinancial,politicalhtsdalous,allbeprotetheIbymaskingthemusiordinaryumbers。
&uronumbers
Hoossible?Anyinformatiobeapoemoraba,ablueprintforaonoraputerprogram,bedeswords。Wemay,however,oaugmethatisusedtomakeupourwordsbeyondtheordihealphabet。Wemayinumbersymbols,punbolsingspecialsymbolsforspaordinarywords,butitishecasethatalltheinformatiootransfer,instrusfpiddiagrams,beexpressedusingwordsfromaussay,hahousandsymbols。Wetthesesymbolsaeachsymboluniquelyasanumber。Sinumbersarediible,itmaybettousenumbersallwiththesamenumberofdigitsforthispurpose(so,forexample,everysymbolresentedusitPIringthesymbolstogetherasrequiredtogiveonebiglooldtheeory。Weworkinbinaryifwewishandsodeviseawayanyinformatioringof0sand1s。Everymessagewemighteverwanttosendbecodedasabinarystringatheotherendbyasuitablyprogrammedputer,tobepiledinethatrehend。Thistherealizatiooseweenonepersonaisenough,bothintheoryandiobeabletosendnumbersfromooanother。
Turnionumbers,however,isnotthebigidea。Tobesure,theexactprocessbywhichalltheinformationisdigitizedmaybehiddenfromthegeneralpubliethelessisnotthesourceofproteeavesdroppers。Ihepointofviewraphy,wemayidentifyaheso-calledplaihtherepresentsitahinkofthatheplaiisassumedthatanyonehasaccesstothewherewithalthatwillalloworaheother。Seesontotheswemasktheseplaihothernumbers。
&roduceyoutothefictitiouscharactersthatpopulatethevarioussariraphy,whichisthestudyofciphers(secretcodes)。WeimagineAlidBob,whowanttouheachother,withoutbeiheeavesdropper,Eve。Instinctively,wemightsympathizewithAlidBEveasuptonogood,butofcoursethereversemaybetrue,withEverepresentinganoblepoligauthtoprotectusallfromtheevilplotsofBobandAlice。
&hemoralstandiits,thereisanage-oldapproachthatAliploytocutEveoutoftheversationeveerceptsmessagesthatpassbetweeheycryptthedatausihatisknownonlytoAlidBob。Whattheymayarraodoistomeetinaseviroheyexgewithoheraseumber(letussay57)aurimees,AlicewillwanttoseoBoband,justtoillustratethepoint,supposethatmessageberepresentedbyasibetween1and9。Onthebigday,AlitstoseoBob。Shetakeshermessageandaddsthesegredient,thatistosayshemasksitstruevaluebyadding57ahemessagetoBob,ainseel,of8+57=65。BobreceivesthismessageandsubtractstheseumbertoretrieveAlitext65-57=8。ThenefariousEve,hoodideawhatthesettoandindeeddoesmaercepttheencipheredmessage,65。Butwhatshedowithit?ShemaykAlitoheninepossiblemessages1,2,3,···,9toBobandalsoknowsthatshehasebyaddihemessage,whichmustthereforeliebetween65-9=55and65-1=64。However,becausesheottellwhichoftheseninemaskingnumbershasbeei),sheishewiserastotheactualplaihatAlittoBob,whichisstilljustaslikelytobeaheninepossibilities。AllsheknowsisthatAlitamessagetoBobbuthasis。
ItmightseemthatAlidBobareothemaliceofEveanduhimpunityusingthemagiumber57todisguisealltheyhavetosay。That,however,ishecase。Theywouldbewelladvisedtogethatnumber,iteroffusiimebecauseiftheydoemwillbegintoleakinformationtoEve。Forexample,sayinafutureweekAlitstosendtoBobthesamemessagenumber8。EverythingwouldrunasbeforeandonEvewouldihemysteriousnumber65fromtheairwaves,butthistimeitwouldtellhersomething。Evehateverthismessageis,itisthesamemessagethatAlittoBobiweek–thisisjustthesortofthingAlidBobwouldoknow。
This,however,lookstobenobigproblemforAlidBob。Whemeetupto‘exgekeys’,insteadonumber,AlicecouldprovideBobwithaloofthousaobeusedoher,thusavoidingthepossibilityofmeaningfultheirpubliclyavailableunis。
Andthisisiisdoice。Thiskindofciphersystemisknowradeasaohesenderaheirplaihasingle-usehe‘pad’。Thatleafofthepadisthehthesenderahemessagehasbeeaheoimepadrepresentsapletelysecuresysteminthattheihattravelsinthepubliainoinformationaboutthetoftheplaiodecipherit,theiorholdofthatpadiaiioionkey。
Keysandkeyexge
Itwouldseemthenthattheproblemofseunipletelysolvedbytheoimepadand,inaway,thatistrue。Thedifficultywithciphersliketheoimepad,however,isthattheyrequirethepartitstoexgeakeyiousethem。Iakesalotofeffh-levelunis,suchasthosebetweeeHouseandtheKremlin,moneyishenecessaryexgesarecarriedoutuionsofmaximumsetheeverydayworldoherhand,allsortsofpeopleandinstitutioouhoherinatialfashioitsotaffordthetimeandeosecurekeyexd,evenifthiswerearrarustedthirdparty,itexpensivebusiness。
Theondrahersthathadbeehousandsofyearsupuntilthe1970swasthattheywereallsymmetricciphers,meaningthattheenaioiallythesame。Whetheritwasthesimplealphabet-shiftcipherofJuliusplexEnigmaCipheroftheSedWorldWar,theyallsufferedfromtheoonadversarylearnedhowyouwereenessages,theyjustaswellasyou。Iomakeuseofasymmetriccipher,theunigpartoexgethecipherkeyinasecure>
&ohavebeentacitlyassumedthatthiswasanunavoidableprincipleofsecretcodes–foraciphertobeusedthepartnersneeded,somehoworother,toexgethekeytothedtokeepitsetheehismightberegardedasmathemationsense。
Thisisthekindofassumptionthatmakesamathematisuspiciwithwhatisessentiallyamathematicalsituation,soosuciple’tobewellfoundedaedbysomeformofmathemati。Yettherewasnosu,atherewasnosurinciplesimplyisnotvalid,asthefollowingthoughtexperimentreveals。
TransmissionefromAlicetoBobdoesnotinitselfheexgeofthekeytoacipher,fortheyproceedasfollows。AlicewritesherplaimessageforBob,ainaboxthatshesecureswithherownpadlolyAlicehasthekeytothislock。ShethenpoststheboxtoBob,whoof。Bob,however,thenaddsasedpadlocktothebox,forossessesthekey。TheboxistheoAliovesherownlodsendstheboxforaseetoBob。Thistime,BobmayunlocktheboxandreadAlice’smessage,sethekhemeddlingEveothavepeekedatthetsduringthedeliveryprothisway,asecretmessagemaybesetonaninseelwithoutAlidBihisimaginarysarioshowsthatthereisnolawthatsaysthatakeymustdsintheexgees。Iem,AlidBob’s‘locks’mightbetheirownessageratherthanaphysicaldeviceseparatingthewould-beeavesdropperfromtheplai。Aliaythehisiosetupanordiriccipherthatwouldbeusedtomaskalltheirfutureuni。
&hisisthewayaseunielisofteablishedintherealwphysigdevicesbyperso,however,soeasytodo。UheengsofAliayihoher,makingtheunsg(thatis,theunlog)thatiscarriedoutfirstbyAlidthenbyBobunworkable。However,thatthismethodbeeffectiveublistratedbyWhitfieldDiffieandMartinHellmanin1976。
Asedrelatedapproachistheideaofasymmetricorpublickeycryptographyinwhiepublishestheirownpublickeythatistheesmeantforthatperson。Hoersonalsoholdsaprivatekey,withoutwhichthemessageseheirownuniquepubliotberead。Ihepadlockmetaphor,AliceprovidesBobwithaboxinwhichtoplacehisplaiogetheradlock(herpublickey)towhichshealohekey(herprivatekey)。
Aublickeysystemmightseemtoomuchtoaskforasthetwisofsedeaseofuseseemtoflict。Fast,safeenis,however,availabletothegeneralpublitheIheybarelyrealizethatitisthere,safeguardierests。Anditisalldowntonumbers,andprimehat。
Howsecretprimesprotectoursecrets
&everyplaimessageisregardedjustasasiisnaturaltotrytomaskthisnumberusingotherhemostonwaytodothisisthroughemployingtheso-calledRSAengprocess,publishedin1978byitsfounders,Ro,AdiShamir,andLeonardAdleman。InRSA,ea’sprivatekeysistsofthreenumbers,p,q,andd,wherepandqare(verylarge)primehethirdidisAlice’ssecretdegheroleofwhichwillbeexplainedinduecourse。Aliceprovidesthepubli=pq,theproductofhertwosecretprimes,andanengnumbere(whiordinarywholenumber,inothespestaionedinChapter2)。
AsimpleexampleforthepurposesofillustrationwouldbeforAlicetohavetheprimesp=5andq=13sothatn=5×13=65。IfAlicesetsherengobee=11,thenherpublickeywouldbe(n,e)=(65,11)。Toencryptamessagem,BobonlyneedsnaodeciphertheencryptedmessageE(m)thatBobtransmitstoAlicerequiresthedegnumberd,whithissouttobed=35,asweshallshowalittlefurtheroicsthatallowsdtobecalculatedrequiresthattheprimespandqareknown。Inthistoyexample,giventhatn=65,anyonewouldsoop=5andq=13。However,iftheprimesparemelylarge(typicallytheyarehunderedsofdigitsihistaskbeesapracticalimpossibilityforalmostaem,atleastinareasonablyshorttime,suchastwoorthreeweeks。Insummary,theRSAsystemofengisbasedontheempiricalfactthatitisprohibitivelydiffidtheprimefactorsofavery,verylargehecleverpart,whichlainintheremaihechapter,liesindevisingawaythatthemessagenumbermcipheredjustusingthepublibers,inpractice,degrequirespossessionoftheprimefa。
HereishohatBobsendsthroughtheetherisheremainderwhenmeisdividedbyheakingthisremainderrandsimilarlygtheremainderwhenrdisdividedbyn。TheunderlyiisuresthattheouteforAliceistheinalmessagem,whitheoordinaryplaibyAliputersystem。Thisis,ofcourse,happeningseamlesslybehindthesesforanyreal-lifeAlidBob。
ItwouldseemthattheonlythingthatEvelacksthatreallymattersisthisdegnumberd。IfEvek,shecoulddecipherthemessagejustaswellasAlice。Itturnsoutthatdisasolutioaiion。SolviionisputationallyquiteeasyaheEuAlgorithm,publishedintheBooksofEu300BC。Thatisnotthedifficulty。Thetroubleisthatitisnotpossibletofilywhatequationtosolveunlessyoukoheprimespandq,andthatistheobstaclethatstopsEveiracks。
laihowthenumbersinvolvedinallthisworkiem。First,thereisapparentlyquiteaproblemwithBob’sinitialtask。Thenumbermisbig,thenumbernismonstrous(oftheorderof200digits)andevehatlarge,thenumbermeisgoiremelylargeaswell。Aftergit,wehavetodividemebythetheremainderr,whichrepresentsthee。Itmightseemthatthecalsaretoouobepractical。Weshouldbeawarethateventhoughmodernputersareextremelypowerful,theyyethavetheirlimitations。Whencalsinvhpowers,theyexceedtheputersystem。Welyethatanypracticalcalthatwesetforaputereinashortperiodoftime。
ThesavinggraceforBobisthatitispossibletofindtherequiredremaihoutdoingthelongdivisionatall。Iheremaidependonremainders,andhereisaoillustratethepoint。Whatarethefinaltwodigitsof739?(Thatistosay,whatistheremaihisnumberisdividedby100?)Ioahisquestiobeginbygthefirstfewpowersof7:71=7,72=49,73=343,74=2,401,75=16,807,···。Itwillsoonbeeclear,however,thatthesheersizeofthesenumbersisgoingtobeanageablewellbefetanywherenear739。Oherhaeoeranother,atterhekeyobservationisthat,aswecalculatesugpowers,thefinaltwodigitsoftheanswerdependowodigitsnumber,aswhenweultipli,digitsinthehundredsnandbeyondhaveonisandtensns。
Whatismore,since74has01asthefinaldigitpair,thefourpowerswillendin07,49,43,andthen01again。Heesugpowers,thepatterwodigitswillsimplyrepeatthiscygthfour,overandaihequestioninhand,since39=4×9+3,wewillpassthroughthisfour-etimesahreemorestepsingthefinaltwodigitsof739,whichmustthereforebe43。