/
Revisiting Fletcher and Adler Checksums Theresa Maxino Carnegie Mellon University Pittsburgh Revisiting Fletcher and Adler Checksums Theresa Maxino Carnegie Mellon University Pittsburgh

Revisiting Fletcher and Adler Checksums Theresa Maxino Carnegie Mellon University Pittsburgh - PDF document

ellena-manuel
ellena-manuel . @ellena-manuel
Follow
559 views
Uploaded On 2014-12-12

Revisiting Fletcher and Adler Checksums Theresa Maxino Carnegie Mellon University Pittsburgh - PPT Presentation

edu Abstract Checksums are routinely used to detect data transmis sion errors However design decisions about which check sum to use are dif64257cult because of a lack of information about relative effectiveness of available options We study the error ID: 22847

edu Abstract Checksums are routinely

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "Revisiting Fletcher and Adler Checksums ..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

ied,includingrandomdata,allzeros,allones,andrepeateddatapatterns.TheHammingDistance(HD)ofachecksumisthesmallestnumberofbiterrorsforwhichthereisatleastoneundetectedcase.Withtheassumptionofrandomindepen-dentbiterrorsinabinarysymmetricchannel,themaincon-tributingfactortochecksumeffectivenessisthefractionofundetectederrorsattheHD,sincetheprobabilityofmoreerrorsoccurringissignicantlylesslikely.Thefaultsin-jectedineachexperimentincludedallpossible1-,2-,and3-biterrorsinthecodewordforeachdatawordvalueex-amined.ThenumberofundetectederrorsattheHDofagivenchecksumalgorithmwasthenusedtocomeupwiththeprobabilityofundetectederrors(Pud)atacertainbiterrorrate(BER)forthatparticularchecksum.3.2.One'sComplementFletcherChecksumTheFletcherchecksum[3][8]isonlydenedfor16-bitand32-bitchecksums,butinprinciplecouldbecomputedforanyblocksizewithanevennumberofbits.Weusetheone'scomplementadditionversion,whichprovidesbet-tererrordetectionthanthetwo'scomplementadditionver-sion.Thiswasconrmedexperimentallyandagreeswith[4].(Throughoutthispaper“Fletcherchecksum”means“one'scomplementadditionFletcherchecksum.”)AFletcherchecksumiscomputedwithablocksizethatishalfthechecksumsize(e.g.,a32-bitFletcherchecksumiscomputedwithablocksizeof16bitsacrossthedataword).Thealgorithmusedtocomputethechecksumit-eratingacrossasetofblocksD0toDnis:Initialvalues:sumA=sumB=0;Foralli:fsumA=sumA+Di;sumB=sumB+sumA;gsumAandsumBarebothcomputedusingthesameblocksize.TheresultingchecksumissumBconcatenatedwithsumAtoformachecksumthatistwicetheblocksize.TheaccumulationofsumBmakesthechecksumsensitivetotheorderinwhichblocksareprocessed.Fletcherchecksumerrordetectionpropertiesaredata-dependent.Forallzerodatatheonlyundetectederrorisoneinwhichallbitsarechangedfromzerostoones.(Recallthat0xFFalsorepresentszeroinone'scomplementnotation.)TheFletcherchecksumhasHD=3uptoacertain,modulo-dependent,codewordlengthandHD=2forallre-mainingcodewordlengths.All2-biterrorsaredetectedfordatawordlengthslessthan(2k=2�1)(k=2)bitswherekisthechecksumsizeand(2k=2�1)isequaltotheFletcherchecksummodulus.[3]statesfurtherthatall2-biterrorsaredetectedprovidedthattheyareseparatedbyfewerthan(2k=2�1)(k=2)bits,kbeingthechecksumsize.ThehighestPudoccurswhendataineachbitpositionoftheblocksisequallydividedbetweenzerosandones.Ran-domdatawordvaluesgiveapproximatelyworstcaseerrordetectionperformanceduetoarelativelyequaldistributionofzerosandonesineachbitposition.TheFletcherchecksumdetectsallbursterrorslessthank=2bitslong,kbeingthechecksumsize.Itisvulnerabletobursterrorsthatinvertbitsfromallzerotoallonesincethosevaluesarebothequaltozeroinone'scomplementnotation(theAdlerchecksumhasthesamevulnerability).Figure1showsFletcherchecksumperformance.ABERof10�5isused,assumingrandomindependentbitinver-sions. Figure1.FletcherandAdlerChecksumPer-formanceforRandomData(meanof10trials)3.3.AdlerChecksumTheAdlerchecksum[2]isonlydenedfor32-bitcheck-sums,butinprinciplecouldbecomputedforanyblocksizewithanevennumberofbits.TheAdlerchecksumissim-ilartotheFletcherchecksumandcanbethoughtofinthefollowingway.Byusingone'scomplementaddition,theFletcherchecksumisperformingintegeradditionmodulo65535for16-bitblocks.TheAdlerchecksuminsteadusesaprimemodulusinanattempttogetbettermixingofthechecksumbits.ThealgorithmisidenticaltotheFletcheralgorithm,exceptsumAisinitializedto1andeachadditionisdonemodulo65521(for32-bitAdlerchecksum)insteadofmodulo65535.AlthoughtheAdlerchecksumisnotofciallydenedforotherdatawordlengths,weusedthelargestprimeintegerslessthan24=16andlessthan28=256toimplement8-and16-bitAdlerchecksumsforcomparisonpurposes.Havingasimilaralgorithm,theAdlerchecksumhassimilarperfor-mancepropertiestotheFletcherchecksum.All2-biterrorsaredetectedfordatawordlengthslessthanM(k=2)bitswherekisthechecksumsizeandMisequaltotheAdler checksummodulus.AswiththeFletcherchecksum,theworstcasePudiswithanequalnumberofzerosandonesineachdatablockbitposition,meaningthatrandomdatahasnearlyworst-caseundetectederrorperformance.Adler-8andAdler-16detectallbursterrorslessthank=2bitslong.Adler-32detectsallbursterrorsupto7-bitslong.([2]denesAdler-32blockstobe1byteor8bitswide.)Figure1showsAdlerchecksumperformance.ABERof10�5isused,assumingrandomindependentbitinversions.4.One'sComplementFletcherChecksumvs.AdlerChecksumTheAdlerchecksumhasbeenputforwardasanim-provementoftheFletcherchecksum[2],anditiscommonlybelievedthattheAdlerchecksumisunconditionallysupe-riortotheFletcherchecksum[7].(Inprivatecommunica-tion,MarkAdlerstatedthatwhat[2]meantwasthatAdler-32isanimprovementoverFletcher-16.Atthattime,hewasnotawareofFletcher-32,butthispointisnotwidelyknownandisnotapparentin[2].)ThebettermixingofbitsthattheAdlerchecksumpro-videsduetoitsprimemodulushasbeenclaimedtoprovidebettererrordetectioncapabilitiesthantheFletchercheck-sum.Wehavefoundthatthisisoftennotthecase.[5]alsoshowsthatFletcher-32isbetterthanAdler-32at8KB.TheAdlerchecksumoutperformstheFletchercheck-sumonlyfor16-bitchecksums,andonlyinthatchecksum'sHD=3performanceregion.TheissueisthatwhiletheprimemodulusintheAdlerchecksumresultsinbettermixing,therearefewer“bins”(i.e.,validFCSvalues)availableforcodewords.Inmostcases,thisreductioninbinsoutweighsthegainsmadebybettermixing.Thus,theFletchercheck-sumissuperiortotheAdlerchecksuminallcasesexceptforAdler-16usedonshortdatawordlengths.Eventhentheimprovementinerrordetectioneffectivenessmightnotbeworththeincreaseincomplexityandcomputationalcostofperformingmodularaddition.5.ComputeCostsSelectionofthebestchecksumforagivenapplicationisusuallynotbasedonerrordetectionpropertiesalone.Otherfactorssuchascomputationalcostfrequentlycomeintoplayaswell.Todeterminethecomputecost,weexaminedtheactualcodethatwasusedinourexperiments.WefoundthattheAdlerchecksumhasacomputecostthatis1.25timesthatoftheFletcherchecksum.ThisagreeswithourexpectationssincetheprimemodulousedbytheAdlerchecksumresultsinadditionalcomputations.Ofcoursetheseperformancenumbersarejustapproximateratiosandmanyfactorsde-terminethebestchoiceforaparticularapplication.6.FutureWorkWeplantolookintotheperformanceofothercommonlyusedchecksums,namely,exclusiveor(XOR),two'scom-plementaddition,one'scomplementaddition,andcyclicredundancycodes(CRC).Wealsoplantore-examinecom-monlyheldnotionsregardingPud,andtherelativeeffec-tivenessoftheFletcherandAdlerchecksumscomparedtoCRCs.7.ConclusionsTheerrordetectionpropertiesoftheFletcherandAdlerchecksumsareverysimilar.However,basedonourstudiesofundetectederrorprobabilities,theFletcherchecksumisoftenabetterchoice.IthasalowercomputationalcostthantheAdlerchecksumand,contrarytopopularbelief,isalsomoreeffectiveinmostsituations.8.AcknowledgementsWewouldliketothankProf.PhilipKoopmanfortheinvaluableinsights,help,andguidancehehasprovidedus.ThisresearchwassupportedinpartbyagrantfromBom-bardierTransportationandtheGeneralMotorsCollabora-tiveResearchLaboratoryatCarnegieMellonUniversity.References[1]R.Braden,D.Borman,andC.Partridge.Computingthein-ternetchecksum.NetworkWorkingGroupRequestforCom-ments(RFC)1071,Sept.1988.[2]P.DeutschandJ.-L.Gailly.ZLIBcompresseddataformatspecicationversion3.3.NetworkWorkingGroupRequestforComments(RFC)1950,May1996.[3]J.G.Fletcher.Anarithmeticchecksumforserialtrans-missions.IEEETransactionsonCommunications,COM-30(1):247–252,Jan.1982.[4]A.Nakassis.Fletcher'serrordetectionalgorithm:Howtoimplementitefcientlyandhowtoavoidthemostcommonpitfalls.ComputerCommunicationReview,18(5):63–88,Oct.1988.[5]D.Sheinwald,J.Satran,P.Thaler,andV.Cavanna.Internetprotocolsmallcomputersysteminterface(iSCSI)cyclicre-dundancycheck(CRC)/checksumconsiderations.NetworkWorkingGroupRequestforComments(RFC)3385,Sept.2002.[6]K.Sklower.ImprovingtheefciencyoftheOSIchecksumcalculation.ComputerCommunicationReview,19(5):44–55,Oct.1989.[7]Wikipedia.Adler-32.http://en.wikipedia.org/wiki/Adler-32.[8]J.ZweigandC.Partridge.TCPalternatechecksumoptions.NetworkWorkingGroupRequestforComments(RFC)1146,Mar.1990. RevisitingFletcherandAdlerChecksumsTheresaMaxinoCarnegieMellonUniversityPittsburgh,PA15213Checksumsareroutinelyusedtodetectdatatransmis-sionerrors.However,designdecisionsaboutwhichcheck-sumtousearedifcultbecauseofalackofinformationaboutrelativeeffectivenessofavailableoptions.WestudytheerrordetectioneffectivenessoftheFletcherandAdlerchecksumsforrandomindependentbiterrorsandburster-rors.OurstudyrevealsthatinmostcasestheFletcherchecksumshouldbeusedinsteadoftheAdlerchecksum.1.IntroductionChecksumsareacommonwaytoensuredataintegrity(e.g.,TCP[1][8],ZLIB[2]).Thispaperexaminestwoofthemostcommonlyusedchecksumapproaches,theFletcherchecksumandtheAdlerchecksum,andevaluatestheircomparativeerrordetectionandcomputecosteffectiveness.OurresultsindicatethattheFletcherchecksumshouldbeusedinsteadoftheAdlerchecksumformostapplications.Inthebalanceofthispaper,wedescribetheFletcherandAdleralgorithmsandtheirperformanceforrandominde-pendentbiterrorsandbursterrors.Errordetectioneffec-tivenessisevaluatedviasimulationresults.Wegiveinsightintothestrengthsandweaknessesofbothchecksums,withanemphasisonparticularvulnerabilitiestoundetecteder-rorsbasedondatavaluesandbiterrorpatterns.Wealsoexaminethecosteffectivenessofboth,andclarifyamis-conceptionregardingtheirrelativeeffectiveness.2.BackgroundandRelatedWorkAchecksumiscreatedbyaddingallthebytesorwordsinadatawordtocreateachecksumvalue.InaFrameCheckSequence(FCS),thechecksumisappendedtothedatawordandtransmittedwithit.Receiversrecomputethechecksumofthereceiveddatawordandcompareittothereceivedchecksumvalue.Ifthecomputedandreceivedchecksummatch,thenitisunlikelythattherewasanerror.Ofcourseitispossiblethatsomepatternofalteredbitsinamessageresultsinanerroneousdatawordmatchingthetransmitted(andalsopotentiallyerroneous)checksumvalue.Thereisatradeoffbetweenthecomputingpowerusedonthecheck-sumcalculation,sizeoftheFCSeld,andprobabilityofsuchundetectederrors.TheFletcherchecksum[3]andthelaterAdlercheck-sum[2]arebothdesignedtogiveerrordetectionpropertiesalmostasgoodasCRCswithsignicantlyreducedcompu-tationalcost.[4]and[6]presentefcientimplementationsfortheFletcherchecksum.AlthoughboththeFletcherandAdlerchecksumshavebeenaroundforyears,littleispublishedabouttheirerrordetectionperformance.Fletcherpublishederrordetectioninformationinhisoriginalpaper[3],and[2]statesthattheAdlerchecksumisanimprovementovertheFletcherchecksum.However,[5]presentsananalyticcomparisonofCRC-32,Fletcher-32,andAdler-32(foracodewordlengthof8KB)thatseeminglycontradicts[2].Thisapparentcon-tradictionencouragedustolookdeeperintothismatter.3.EffectivenessEvaluation3.1.MethodologyPerformanceevaluationofbothchecksumalgorithmswasviasimulatedfaultinjection.Eachexperimentgen-eratedadatawordwithaspecicdatavalue,thencom-putedachecksumacrossthatdataword.Theresultantcodeword(datawordpluschecksum)wassubjectedtoaspe-cicnumberofbitinversionfaults.Thechecksumofthefaultydatawordwasthencomputedandcomparedagainstthe(potentiallyalsofaulty)FCSvalueofthefaultycode-word.IftheFCSvalueofthefaultycodewordmatchedthechecksumcomputedacrossthefaultydataword,thatpar-ticularsetofbitinversionswasundetectedbythechecksumalgorithmused.Identicaldatawordvalueswereusedforbothchecksums.Datawordlengthswerealwaysmultiplesofthechecksumsize.Thedatausedineachexperimentvar- checksummodulus.AswiththeFletcherchecksum,theworstcaseiswithanequalnumberofzerosandonesineachdatablockbitposition,meaningthatrandomdatahasnearlyworst-caseundetectederrorperformance.Adler-8andAdler-16detectallbursterrorslessthank=bitslong.Adler-32detectsallbursterrorsupto7-bitslong.([2]denesAdler-32blockstobe1byteor8bitswide.)Figure1showsAdlerchecksumperformance.ABERofisused,assumingrandomindependentbitinversions.4.One'sComplementFletcherChecksumvs.AdlerChecksumTheAdlerchecksumhasbeenputforwardasanim-provementoftheFletcherchecksum[2],anditiscommonlybelievedthattheAdlerchecksumisunconditionallysupe-riortotheFletcherchecksum[7].(Inprivatecommunica-tion,MarkAdlerstatedthatwhat[2]meantwasthatAdler-32isanimprovementoverFletcher-16.Atthattime,hewasnotawareofFletcher-32,butthispointisnotwidelyknownandisnotapparentin[2].)ThebettermixingofbitsthattheAdlerchecksumpro-videsduetoitsprimemodulushasbeenclaimedtoprovidebettererrordetectioncapabilitiesthantheFletchercheck-sum.Wehavefoundthatthisisoftennotthecase.[5]alsoshowsthatFletcher-32isbetterthanAdler-32at8KB.TheAdlerchecksumoutperformstheFletchercheck-sumonlyfor16-bitchecksums,andonlyinthatchecksum'sHD=3performanceregion.TheissueisthatwhiletheprimemodulusintheAdlerchecksumresultsinbettermixing,therearefewer“bins”(i.e.,validFCSvalues)availableforcodewords.Inmostcases,thisreductioninbinsoutweighsthegainsmadebybettermixing.Thus,theFletchercheck-sumissuperiortotheAdlerchecksuminallcasesexceptforAdler-16usedonshortdatawordlengths.Eventhentheimprovementinerrordetectioneffectivenessmightnotbeworththeincreaseincomplexityandcomputationalcostofperformingmodularaddition.5.ComputeCostsSelectionofthebestchecksumforagivenapplicationisusuallynotbasedonerrordetectionpropertiesalone.Otherfactorssuchascomputationalcostfrequentlycomeintoplayaswell.Todeterminethecomputecost,weexaminedtheactualcodethatwasusedinourexperiments.WefoundthattheAdlerchecksumhasacomputecostthatis1.25timesthatoftheFletcherchecksum.ThisagreeswithourexpectationssincetheprimemodulousedbytheAdlerchecksumresultsinadditionalcomputations.Ofcoursetheseperformancenumbersarejustapproximateratiosandmanyfactorsde-terminethebestchoiceforaparticularapplication.6.FutureWorkWeplantolookintotheperformanceofothercommonlyusedchecksums,namely,exclusiveor(XOR),two'scom-plementaddition,one'scomplementaddition,andcyclicredundancycodes(CRC).Wealsoplantore-examinecom-monlyheldnotionsregarding,andtherelativeeffec-tivenessoftheFletcherandAdlerchecksumscomparedto7.ConclusionsTheerrordetectionpropertiesoftheFletcherandAdlerchecksumsareverysimilar.However,basedonourstudiesofundetectederrorprobabilities,theFletcherchecksumisoftenabetterchoice.IthasalowercomputationalcostthantheAdlerchecksumand,contrarytopopularbelief,isalsomoreeffectiveinmostsituations.8.AcknowledgementsWewouldliketothankProf.PhilipKoopmanfortheinvaluableinsights,help,andguidancehehasprovidedus.ThisresearchwassupportedinpartbyagrantfromBom-bardierTransportationandtheGeneralMotorsCollabora-tiveResearchLaboratoryatCarnegieMellonUniversity.References[1]R.Braden,D.Borman,andC.Partridge.Computingthein-ternetchecksum.NetworkWorkingGroupRequestforCom-ments(RFC)1071,Sept.1988.[2]P.DeutschandJ.-L.Gailly.ZLIBcompresseddataformatspecicationversion3.3.NetworkWorkingGroupRequestforComments(RFC)1950,May1996.[3]J.G.Fletcher.Anarithmeticchecksumforserialtrans-IEEETransactionsonCommunications,COM-30(1):247–252,Jan.1982.[4]A.Nakassis.Fletcher'serrordetectionalgorithm:Howtoimplementitefcientlyandhowtoavoidthemostcommonpitfalls.ComputerCommunicationReview,18(5):63–88,Oct.[5]D.Sheinwald,J.Satran,P.Thaler,andV.Cavanna.Internetprotocolsmallcomputersysteminterface(iSCSI)cyclicre-dundancycheck(CRC)/checksumconsiderations.NetworkWorkingGroupRequestforComments(RFC)3385,Sept.[6]K.Sklower.ImprovingtheefciencyoftheOSIchecksumComputerCommunicationReview,19(5):44–55,Oct.1989.[7]Wikipedia.Adler-32.http://en.wikipedia.org/wiki/Adler-32.[8]J.ZweigandC.Partridge.TCPalternatechecksumoptions.NetworkWorkingGroupRequestforComments(RFC)1146,Mar.1990. RevisitingFletcherandAdlerChecksumsTheresaMaxinoCarnegieMellonUniversityPittsburgh,PA15213Checksumsareroutinelyusedtodetectdatatransmis-sionerrors.However,designdecisionsaboutwhichcheck-sumtousearedifcultbecauseofalackofinformationaboutrelativeeffectivenessofavailableoptions.WestudytheerrordetectioneffectivenessoftheFletcherandAdlerchecksumsforrandomindependentbiterrorsandburster-rors.OurstudyrevealsthatinmostcasestheFletcherchecksumshouldbeusedinsteadoftheAdlerchecksum.1.IntroductionChecksumsareacommonwaytoensuredataintegrity(e.g.,TCP[1][8],ZLIB[2]).Thispaperexaminestwoofthemostcommonlyusedchecksumapproaches,theFletcherchecksumandtheAdlerchecksum,andevaluatestheircomparativeerrordetectionandcomputecosteffectiveness.OurresultsindicatethattheFletcherchecksumshouldbeusedinsteadoftheAdlerchecksumformostapplications.Inthebalanceofthispaper,wedescribetheFletcherandAdleralgorithmsandtheirperformanceforrandominde-pendentbiterrorsandbursterrors.Errordetectioneffec-tivenessisevaluatedviasimulationresults.Wegiveinsightintothestrengthsandweaknessesofbothchecksums,withanemphasisonparticularvulnerabilitiestoundetecteder-rorsbasedondatavaluesandbiterrorpatterns.Wealsoexaminethecosteffectivenessofboth,andclarifyamis-conceptionregardingtheirrelativeeffectiveness.2.BackgroundandRelatedWorkAchecksumiscreatedbyaddingallthebytesorwordsinadatawordtocreateachecksumvalue.InaFrameCheckSequence(FCS),thechecksumisappendedtothedatawordandtransmittedwithit.Receiversrecomputethechecksumofthereceiveddatawordandcompareittothereceivedchecksumvalue.Ifthecomputedandreceivedchecksummatch,thenitisunlikelythattherewasanerror.Ofcourseitispossiblethatsomepatternofalteredbitsinamessageresultsinanerroneousdatawordmatchingthetransmitted(andalsopotentiallyerroneous)checksumvalue.Thereisatradeoffbetweenthecomputingpowerusedonthecheck-sumcalculation,sizeoftheFCSeld,andprobabilityofsuchundetectederrors.TheFletcherchecksum[3]andthelaterAdlercheck-sum[2]arebothdesignedtogiveerrordetectionpropertiesalmostasgoodasCRCswithsignicantlyreducedcompu-tationalcost.[4]and[6]presentefcientimplementationsfortheFletcherchecksum.AlthoughboththeFletcherandAdlerchecksumshavebeenaroundforyears,littleispublishedabouttheirerrordetectionperformance.Fletcherpublishederrordetectioninformationinhisoriginalpaper[3],and[2]statesthattheAdlerchecksumisanimprovementovertheFletcherchecksum.However,[5]presentsananalyticcomparisonofCRC-32,Fletcher-32,andAdler-32(foracodewordlengthof8KB)thatseeminglycontradicts[2].Thisapparentcon-tradictionencouragedustolookdeeperintothismatter.3.EffectivenessEvaluation3.1.MethodologyPerformanceevaluationofbothchecksumalgorithmswasviasimulatedfaultinjection.Eachexperimentgen-eratedadatawordwithaspecicdatavalue,thencom-putedachecksumacrossthatdataword.Theresultantcodeword(datawordpluschecksum)wassubjectedtoaspe-cicnumberofbitinversionfaults.Thechecksumofthefaultydatawordwasthencomputedandcomparedagainstthe(potentiallyalsofaulty)FCSvalueofthefaultycode-word.IftheFCSvalueofthefaultycodewordmatchedthechecksumcomputedacrossthefaultydataword,thatpar-ticularsetofbitinversionswasundetectedbythechecksumalgorithmused.Identicaldatawordvalueswereusedforbothchecksums.Datawordlengthswerealwaysmultiplesofthechecksumsize.Thedatausedineachexperimentvar- checksummodulus.AswiththeFletcherchecksum,theworstcaseiswithanequalnumberofzerosandonesineachdatablockbitposition,meaningthatrandomdatahasnearlyworst-caseundetectederrorperformance.Adler-8andAdler-16detectallbursterrorslessthank=bitslong.Adler-32detectsallbursterrorsupto7-bitslong.([2]denesAdler-32blockstobe1byteor8bitswide.)Figure1showsAdlerchecksumperformance.ABERofisused,assumingrandomindependentbitinversions.4.One'sComplementFletcherChecksumvs.AdlerChecksumTheAdlerchecksumhasbeenputforwardasanim-provementoftheFletcherchecksum[2],anditiscommonlybelievedthattheAdlerchecksumisunconditionallysupe-riortotheFletcherchecksum[7].(Inprivatecommunica-tion,MarkAdlerstatedthatwhat[2]meantwasthatAdler-32isanimprovementoverFletcher-16.Atthattime,hewasnotawareofFletcher-32,butthispointisnotwidelyknownandisnotapparentin[2].)ThebettermixingofbitsthattheAdlerchecksumpro-videsduetoitsprimemodulushasbeenclaimedtoprovidebettererrordetectioncapabilitiesthantheFletchercheck-sum.Wehavefoundthatthisisoftennotthecase.[5]alsoshowsthatFletcher-32isbetterthanAdler-32at8KB.TheAdlerchecksumoutperformstheFletchercheck-sumonlyfor16-bitchecksums,andonlyinthatchecksum'sHD=3performanceregion.TheissueisthatwhiletheprimemodulusintheAdlerchecksumresultsinbettermixing,therearefewer“bins”(i.e.,validFCSvalues)availableforcodewords.Inmostcases,thisreductioninbinsoutweighsthegainsmadebybettermixing.Thus,theFletchercheck-sumissuperiortotheAdlerchecksuminallcasesexceptforAdler-16usedonshortdatawordlengths.Eventhentheimprovementinerrordetectioneffectivenessmightnotbeworththeincreaseincomplexityandcomputationalcostofperformingmodularaddition.5.ComputeCostsSelectionofthebestchecksumforagivenapplicationisusuallynotbasedonerrordetectionpropertiesalone.Otherfactorssuchascomputationalcostfrequentlycomeintoplayaswell.Todeterminethecomputecost,weexaminedtheactualcodethatwasusedinourexperiments.WefoundthattheAdlerchecksumhasacomputecostthatis1.25timesthatoftheFletcherchecksum.ThisagreeswithourexpectationssincetheprimemodulousedbytheAdlerchecksumresultsinadditionalcomputations.Ofcoursetheseperformancenumbersarejustapproximateratiosandmanyfactorsde-terminethebestchoiceforaparticularapplication.6.FutureWorkWeplantolookintotheperformanceofothercommonlyusedchecksums,namely,exclusiveor(XOR),two'scom-plementaddition,one'scomplementaddition,andcyclicredundancycodes(CRC).Wealsoplantore-examinecom-monlyheldnotionsregarding,andtherelativeeffec-tivenessoftheFletcherandAdlerchecksumscomparedto7.ConclusionsTheerrordetectionpropertiesoftheFletcherandAdlerchecksumsareverysimilar.However,basedonourstudiesofundetectederrorprobabilities,theFletcherchecksumisoftenabetterchoice.IthasalowercomputationalcostthantheAdlerchecksumand,contrarytopopularbelief,isalsomoreeffectiveinmostsituations.8.AcknowledgementsWewouldliketothankProf.PhilipKoopmanfortheinvaluableinsights,help,andguidancehehasprovidedus.ThisresearchwassupportedinpartbyagrantfromBom-bardierTransportationandtheGeneralMotorsCollabora-tiveResearchLaboratoryatCarnegieMellonUniversity.References[1]R.Braden,D.Borman,andC.Partridge.Computingthein-ternetchecksum.NetworkWorkingGroupRequestforCom-ments(RFC)1071,Sept.1988.[2]P.DeutschandJ.-L.Gailly.ZLIBcompresseddataformatspecicationversion3.3.NetworkWorkingGroupRequestforComments(RFC)1950,May1996.[3]J.G.Fletcher.Anarithmeticchecksumforserialtrans-IEEETransactionsonCommunications,COM-30(1):247–252,Jan.1982.[4]A.Nakassis.Fletcher'serrordetectionalgorithm:Howtoimplementitefcientlyandhowtoavoidthemostcommonpitfalls.ComputerCommunicationReview,18(5):63–88,Oct.[5]D.Sheinwald,J.Satran,P.Thaler,andV.Cavanna.Internetprotocolsmallcomputersysteminterface(iSCSI)cyclicre-dundancycheck(CRC)/checksumconsiderations.NetworkWorkingGroupRequestforComments(RFC)3385,Sept.[6]K.Sklower.ImprovingtheefciencyoftheOSIchecksumComputerCommunicationReview,19(5):44–55,Oct.1989.[7]Wikipedia.Adler-32.http://en.wikipedia.org/wiki/Adler-32.[8]J.ZweigandC.Partridge.TCPalternatechecksumoptions.NetworkWorkingGroupRequestforComments(RFC)1146,Mar.1990. RevisitingFletcherandAdlerChecksumsTheresaMaxinoCarnegieMellonUniversityPittsburgh,PA15213Checksumsareroutinelyusedtodetectdatatransmis-sionerrors.However,designdecisionsaboutwhichcheck-sumtousearedifcultbecauseofalackofinformationaboutrelativeeffectivenessofavailableoptions.WestudytheerrordetectioneffectivenessoftheFletcherandAdlerchecksumsforrandomindependentbiterrorsandburster-rors.OurstudyrevealsthatinmostcasestheFletcherchecksumshouldbeusedinsteadoftheAdlerchecksum.1.IntroductionChecksumsareacommonwaytoensuredataintegrity(e.g.,TCP[1][8],ZLIB[2]).Thispaperexaminestwoofthemostcommonlyusedchecksumapproaches,theFletcherchecksumandtheAdlerchecksum,andevaluatestheircomparativeerrordetectionandcomputecosteffectiveness.OurresultsindicatethattheFletcherchecksumshouldbeusedinsteadoftheAdlerchecksumformostapplications.Inthebalanceofthispaper,wedescribetheFletcherandAdleralgorithmsandtheirperformanceforrandominde-pendentbiterrorsandbursterrors.Errordetectioneffec-tivenessisevaluatedviasimulationresults.Wegiveinsightintothestrengthsandweaknessesofbothchecksums,withanemphasisonparticularvulnerabilitiestoundetecteder-rorsbasedondatavaluesandbiterrorpatterns.Wealsoexaminethecosteffectivenessofboth,andclarifyamis-conceptionregardingtheirrelativeeffectiveness.2.BackgroundandRelatedWorkAchecksumiscreatedbyaddingallthebytesorwordsinadatawordtocreateachecksumvalue.InaFrameCheckSequence(FCS),thechecksumisappendedtothedatawordandtransmittedwithit.Receiversrecomputethechecksumofthereceiveddatawordandcompareittothereceivedchecksumvalue.Ifthecomputedandreceivedchecksummatch,thenitisunlikelythattherewasanerror.Ofcourseitispossiblethatsomepatternofalteredbitsinamessageresultsinanerroneousdatawordmatchingthetransmitted(andalsopotentiallyerroneous)checksumvalue.Thereisatradeoffbetweenthecomputingpowerusedonthecheck-sumcalculation,sizeoftheFCSeld,andprobabilityofsuchundetectederrors.TheFletcherchecksum[3]andthelaterAdlercheck-sum[2]arebothdesignedtogiveerrordetectionpropertiesalmostasgoodasCRCswithsignicantlyreducedcompu-tationalcost.[4]and[6]presentefcientimplementationsfortheFletcherchecksum.AlthoughboththeFletcherandAdlerchecksumshavebeenaroundforyears,littleispublishedabouttheirerrordetectionperformance.Fletcherpublishederrordetectioninformationinhisoriginalpaper[3],and[2]statesthattheAdlerchecksumisanimprovementovertheFletcherchecksum.However,[5]presentsananalyticcomparisonofCRC-32,Fletcher-32,andAdler-32(foracodewordlengthof8KB)thatseeminglycontradicts[2].Thisapparentcon-tradictionencouragedustolookdeeperintothismatter.3.EffectivenessEvaluation3.1.MethodologyPerformanceevaluationofbothchecksumalgorithmswasviasimulatedfaultinjection.Eachexperimentgen-eratedadatawordwithaspecicdatavalue,thencom-putedachecksumacrossthatdataword.Theresultantcodeword(datawordpluschecksum)wassubjectedtoaspe-cicnumberofbitinversionfaults.Thechecksumofthefaultydatawordwasthencomputedandcomparedagainstthe(potentiallyalsofaulty)FCSvalueofthefaultycode-word.IftheFCSvalueofthefaultycodewordmatchedthechecksumcomputedacrossthefaultydataword,thatpar-ticularsetofbitinversionswasundetectedbythechecksumalgorithmused.Identicaldatawordvalueswereusedforbothchecksums.Datawordlengthswerealwaysmultiplesofthechecksumsize.Thedatausedineachexperimentvar- checksummodulus.AswiththeFletcherchecksum,theworstcaseiswithanequalnumberofzerosandonesineachdatablockbitposition,meaningthatrandomdatahasnearlyworst-caseundetectederrorperformance.Adler-8andAdler-16detectallbursterrorslessthank=bitslong.Adler-32detectsallbursterrorsupto7-bitslong.([2]denesAdler-32blockstobe1byteor8bitswide.)Figure1showsAdlerchecksumperformance.ABERofisused,assumingrandomindependentbitinversions.4.One'sComplementFletcherChecksumvs.AdlerChecksumTheAdlerchecksumhasbeenputforwardasanim-provementoftheFletcherchecksum[2],anditiscommonlybelievedthattheAdlerchecksumisunconditionallysupe-riortotheFletcherchecksum[7].(Inprivatecommunica-tion,MarkAdlerstatedthatwhat[2]meantwasthatAdler-32isanimprovementoverFletcher-16.Atthattime,hewasnotawareofFletcher-32,butthispointisnotwidelyknownandisnotapparentin[2].)ThebettermixingofbitsthattheAdlerchecksumpro-videsduetoitsprimemodulushasbeenclaimedtoprovidebettererrordetectioncapabilitiesthantheFletchercheck-sum.Wehavefoundthatthisisoftennotthecase.[5]alsoshowsthatFletcher-32isbetterthanAdler-32at8KB.TheAdlerchecksumoutperformstheFletchercheck-sumonlyfor16-bitchecksums,andonlyinthatchecksum'sHD=3performanceregion.TheissueisthatwhiletheprimemodulusintheAdlerchecksumresultsinbettermixing,therearefewer“bins”(i.e.,validFCSvalues)availableforcodewords.Inmostcases,thisreductioninbinsoutweighsthegainsmadebybettermixing.Thus,theFletchercheck-sumissuperiortotheAdlerchecksuminallcasesexceptforAdler-16usedonshortdatawordlengths.Eventhentheimprovementinerrordetectioneffectivenessmightnotbeworththeincreaseincomplexityandcomputationalcostofperformingmodularaddition.5.ComputeCostsSelectionofthebestchecksumforagivenapplicationisusuallynotbasedonerrordetectionpropertiesalone.Otherfactorssuchascomputationalcostfrequentlycomeintoplayaswell.Todeterminethecomputecost,weexaminedtheactualcodethatwasusedinourexperiments.WefoundthattheAdlerchecksumhasacomputecostthatis1.25timesthatoftheFletcherchecksum.ThisagreeswithourexpectationssincetheprimemodulousedbytheAdlerchecksumresultsinadditionalcomputations.Ofcoursetheseperformancenumbersarejustapproximateratiosandmanyfactorsde-terminethebestchoiceforaparticularapplication.6.FutureWorkWeplantolookintotheperformanceofothercommonlyusedchecksums,namely,exclusiveor(XOR),two'scom-plementaddition,one'scomplementaddition,andcyclicredundancycodes(CRC).Wealsoplantore-examinecom-monlyheldnotionsregarding,andtherelativeeffec-tivenessoftheFletcherandAdlerchecksumscomparedto7.ConclusionsTheerrordetectionpropertiesoftheFletcherandAdlerchecksumsareverysimilar.However,basedonourstudiesofundetectederrorprobabilities,theFletcherchecksumisoftenabetterchoice.IthasalowercomputationalcostthantheAdlerchecksumand,contrarytopopularbelief,isalsomoreeffectiveinmostsituations.8.AcknowledgementsWewouldliketothankProf.PhilipKoopmanfortheinvaluableinsights,help,andguidancehehasprovidedus.ThisresearchwassupportedinpartbyagrantfromBom-bardierTransportationandtheGeneralMotorsCollabora-tiveResearchLaboratoryatCarnegieMellonUniversity.References[1]R.Braden,D.Borman,andC.Partridge.Computingthein-ternetchecksum.NetworkWorkingGroupRequestforCom-ments(RFC)1071,Sept.1988.[2]P.DeutschandJ.-L.Gailly.ZLIBcompresseddataformatspecicationversion3.3.NetworkWorkingGroupRequestforComments(RFC)1950,May1996.[3]J.G.Fletcher.Anarithmeticchecksumforserialtrans-IEEETransactionsonCommunications,COM-30(1):247–252,Jan.1982.[4]A.Nakassis.Fletcher'serrordetectionalgorithm:Howtoimplementitefcientlyandhowtoavoidthemostcommonpitfalls.ComputerCommunicationReview,18(5):63–88,Oct.[5]D.Sheinwald,J.Satran,P.Thaler,andV.Cavanna.Internetprotocolsmallcomputersysteminterface(iSCSI)cyclicre-dundancycheck(CRC)/checksumconsiderations.NetworkWorkingGroupRequestforComments(RFC)3385,Sept.[6]K.Sklower.ImprovingtheefciencyoftheOSIchecksumComputerCommunicationReview,19(5):44–55,Oct.1989.[7]Wikipedia.Adler-32.http://en.wikipedia.org/wiki/Adler-32.[8]J.ZweigandC.Partridge.TCPalternatechecksumoptions.NetworkWorkingGroupRequestforComments(RFC)1146,Mar.1990. RevisitingFletcherandAdlerChecksumsTheresaMaxinoCarnegieMellonUniversityPittsburgh,PA15213Checksumsareroutinelyusedtodetectdatatransmis-sionerrors.However,designdecisionsaboutwhichcheck-sumtousearedifcultbecauseofalackofinformationaboutrelativeeffectivenessofavailableoptions.WestudytheerrordetectioneffectivenessoftheFletcherandAdlerchecksumsforrandomindependentbiterrorsandburster-rors.OurstudyrevealsthatinmostcasestheFletcherchecksumshouldbeusedinsteadoftheAdlerchecksum.1.IntroductionChecksumsareacommonwaytoensuredataintegrity(e.g.,TCP[1][8],ZLIB[2]).Thispaperexaminestwoofthemostcommonlyusedchecksumapproaches,theFletcherchecksumandtheAdlerchecksum,andevaluatestheircomparativeerrordetectionandcomputecosteffectiveness.OurresultsindicatethattheFletcherchecksumshouldbeusedinsteadoftheAdlerchecksumformostapplications.Inthebalanceofthispaper,wedescribetheFletcherandAdleralgorithmsandtheirperformanceforrandominde-pendentbiterrorsandbursterrors.Errordetectioneffec-tivenessisevaluatedviasimulationresults.Wegiveinsightintothestrengthsandweaknessesofbothchecksums,withanemphasisonparticularvulnerabilitiestoundetecteder-rorsbasedondatavaluesandbiterrorpatterns.Wealsoexaminethecosteffectivenessofboth,andclarifyamis-conceptionregardingtheirrelativeeffectiveness.2.BackgroundandRelatedWorkAchecksumiscreatedbyaddingallthebytesorwordsinadatawordtocreateachecksumvalue.InaFrameCheckSequence(FCS),thechecksumisappendedtothedatawordandtransmittedwithit.Receiversrecomputethechecksumofthereceiveddatawordandcompareittothereceivedchecksumvalue.Ifthecomputedandreceivedchecksummatch,thenitisunlikelythattherewasanerror.Ofcourseitispossiblethatsomepatternofalteredbitsinamessageresultsinanerroneousdatawordmatchingthetransmitted(andalsopotentiallyerroneous)checksumvalue.Thereisatradeoffbetweenthecomputingpowerusedonthecheck-sumcalculation,sizeoftheFCSeld,andprobabilityofsuchundetectederrors.TheFletcherchecksum[3]andthelaterAdlercheck-sum[2]arebothdesignedtogiveerrordetectionpropertiesalmostasgoodasCRCswithsignicantlyreducedcompu-tationalcost.[4]and[6]presentefcientimplementationsfortheFletcherchecksum.AlthoughboththeFletcherandAdlerchecksumshavebeenaroundforyears,littleispublishedabouttheirerrordetectionperformance.Fletcherpublishederrordetectioninformationinhisoriginalpaper[3],and[2]statesthattheAdlerchecksumisanimprovementovertheFletcherchecksum.However,[5]presentsananalyticcomparisonofCRC-32,Fletcher-32,andAdler-32(foracodewordlengthof8KB)thatseeminglycontradicts[2].Thisapparentcon-tradictionencouragedustolookdeeperintothismatter.3.EffectivenessEvaluation3.1.MethodologyPerformanceevaluationofbothchecksumalgorithmswasviasimulatedfaultinjection.Eachexperimentgen-eratedadatawordwithaspecicdatavalue,thencom-putedachecksumacrossthatdataword.Theresultantcodeword(datawordpluschecksum)wassubjectedtoaspe-cicnumberofbitinversionfaults.Thechecksumofthefaultydatawordwasthencomputedandcomparedagainstthe(potentiallyalsofaulty)FCSvalueofthefaultycode-word.IftheFCSvalueofthefaultycodewordmatchedthechecksumcomputedacrossthefaultydataword,thatpar-ticularsetofbitinversionswasundetectedbythechecksumalgorithmused.Identicaldatawordvalueswereusedforbothchecksums.Datawordlengthswerealwaysmultiplesofthechecksumsize.Thedatausedineachexperimentvar- checksummodulus.AswiththeFletcherchecksum,theworstcaseiswithanequalnumberofzerosandonesineachdatablockbitposition,meaningthatrandomdatahasnearlyworst-caseundetectederrorperformance.Adler-8andAdler-16detectallbursterrorslessthank=bitslong.Adler-32detectsallbursterrorsupto7-bitslong.([2]denesAdler-32blockstobe1byteor8bitswide.)Figure1showsAdlerchecksumperformance.ABERofisused,assumingrandomindependentbitinversions.4.One'sComplementFletcherChecksumvs.AdlerChecksumTheAdlerchecksumhasbeenputforwardasanim-provementoftheFletcherchecksum[2],anditiscommonlybelievedthattheAdlerchecksumisunconditionallysupe-riortotheFletcherchecksum[7].(Inprivatecommunica-tion,MarkAdlerstatedthatwhat[2]meantwasthatAdler-32isanimprovementoverFletcher-16.Atthattime,hewasnotawareofFletcher-32,butthispointisnotwidelyknownandisnotapparentin[2].)ThebettermixingofbitsthattheAdlerchecksumpro-videsduetoitsprimemodulushasbeenclaimedtoprovidebettererrordetectioncapabilitiesthantheFletchercheck-sum.Wehavefoundthatthisisoftennotthecase.[5]alsoshowsthatFletcher-32isbetterthanAdler-32at8KB.TheAdlerchecksumoutperformstheFletchercheck-sumonlyfor16-bitchecksums,andonlyinthatchecksum'sHD=3performanceregion.TheissueisthatwhiletheprimemodulusintheAdlerchecksumresultsinbettermixing,therearefewer“bins”(i.e.,validFCSvalues)availableforcodewords.Inmostcases,thisreductioninbinsoutweighsthegainsmadebybettermixing.Thus,theFletchercheck-sumissuperiortotheAdlerchecksuminallcasesexceptforAdler-16usedonshortdatawordlengths.Eventhentheimprovementinerrordetectioneffectivenessmightnotbeworththeincreaseincomplexityandcomputationalcostofperformingmodularaddition.5.ComputeCostsSelectionofthebestchecksumforagivenapplicationisusuallynotbasedonerrordetectionpropertiesalone.Otherfactorssuchascomputationalcostfrequentlycomeintoplayaswell.Todeterminethecomputecost,weexaminedtheactualcodethatwasusedinourexperiments.WefoundthattheAdlerchecksumhasacomputecostthatis1.25timesthatoftheFletcherchecksum.ThisagreeswithourexpectationssincetheprimemodulousedbytheAdlerchecksumresultsinadditionalcomputations.Ofcoursetheseperformancenumbersarejustapproximateratiosandmanyfactorsde-terminethebestchoiceforaparticularapplication.6.FutureWorkWeplantolookintotheperformanceofothercommonlyusedchecksums,namely,exclusiveor(XOR),two'scom-plementaddition,one'scomplementaddition,andcyclicredundancycodes(CRC).Wealsoplantore-examinecom-monlyheldnotionsregarding,andtherelativeeffec-tivenessoftheFletcherandAdlerchecksumscomparedto7.ConclusionsTheerrordetectionpropertiesoftheFletcherandAdlerchecksumsareverysimilar.However,basedonourstudiesofundetectederrorprobabilities,theFletcherchecksumisoftenabetterchoice.IthasalowercomputationalcostthantheAdlerchecksumand,contrarytopopularbelief,isalsomoreeffectiveinmostsituations.8.AcknowledgementsWewouldliketothankProf.PhilipKoopmanfortheinvaluableinsights,help,andguidancehehasprovidedus.ThisresearchwassupportedinpartbyagrantfromBom-bardierTransportationandtheGeneralMotorsCollabora-tiveResearchLaboratoryatCarnegieMellonUniversity.References[1]R.Braden,D.Borman,andC.Partridge.Computingthein-ternetchecksum.NetworkWorkingGroupRequestforCom-ments(RFC)1071,Sept.1988.[2]P.DeutschandJ.-L.Gailly.ZLIBcompresseddataformatspecicationversion3.3.NetworkWorkingGroupRequestforComments(RFC)1950,May1996.[3]J.G.Fletcher.Anarithmeticchecksumforserialtrans-IEEETransactionsonCommunications,COM-30(1):247–252,Jan.1982.[4]A.Nakassis.Fletcher'serrordetectionalgorithm:Howtoimplementitefcientlyandhowtoavoidthemostcommonpitfalls.ComputerCommunicationReview,18(5):63–88,Oct.[5]D.Sheinwald,J.Satran,P.Thaler,andV.Cavanna.Internetprotocolsmallcomputersysteminterface(iSCSI)cyclicre-dundancycheck(CRC)/checksumconsiderations.NetworkWorkingGroupRequestforComments(RFC)3385,Sept.[6]K.Sklower.ImprovingtheefciencyoftheOSIchecksumComputerCommunicationReview,19(5):44–55,Oct.1989.[7]Wikipedia.Adler-32.http://en.wikipedia.org/wiki/Adler-32.[8]J.ZweigandC.Partridge.TCPalternatechecksumoptions.NetworkWorkingGroupRequestforComments(RFC)1146,Mar.1990.