Check code

Composition

Anycodewithacheckcodeiscomposedoftwoparts:thebodycodeandthecheckcode(suchastheorganizationcode).Thebodycodeisthenumberthatrepresentsthecodeobject.Theverificationcodeisanumberattachedtothebodycodetoverifytheaccuracyofthebodycodeduringtheinputprocess.Eachbodycodecanonlyhaveonecheckcode,andthecheckcodeisobtainedthroughaprescribedmathematicalrelationship.

Principleofverification

Thesystemispresetwithaverificationprogramcompiledaccordingtotheverificationformuladerivedfromtheverificationmethod.Whenthecodewiththeverificationcodeisinputintothesystem,Thesystemusestheverificationprogramtocalculatetheinputbodycodetoobtaintheverificationresult,andthencomparestheverificationresultwiththeverificationcodeoftheinputcodetocheckwhethertheinputiscorrectornot.Ifthetwoareconsistent,itmeansthatthecodeisenteredcorrectlyandthesystemallowsentry;iftheyareinconsistent,itmeansthatthecodeisenteredincorrectly,andthesystemrefusestoenterandrequiresthecodetobere-entered.

Checksumalgorithm

Differentchecksumalgorithmsareoftendifferent.Commoncheckcodealgorithmsinclude:codedistance,paritycheck,Hammingcheck,cyclicredundancycheck,etc.

Algorithmexample

IDcardcheckcode

AccordingtothenationalstandardGB11643-1999ofthePeople’sRepublicofChina,thecalculationmethodfortheverificationcodeofthecitizen’sidentitynumberofthePeople’sRepublicofChinaistheISO7064:1983.MOD11-2verificationcodecalculationmethod.

Assuminga17-digitnumberis

17-digitnumber

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

Weightingfactor

7

9

10

5

8

4

2

1

6

3

7

9

10

5

8

4

2

368

Calculatethesumoftheproductofthe17-digitnumberandthecorrespondingweightingfactorS:1×7+2×9+3×10+4×5+5×8+6×4+7×2+8×1+9×6+0×3+1×7+2×9+3×10+4×5+5×8+6×4+7×2=368;CalculatetheremainderTofS÷11:368mod11=5;CalculatetheremainderRof(12-T)÷11,ifR=10,thecheckcodeisaletter"X";ifR≠10,thecheckcodeisthenumber"R":(12-5)mod11=7.The17-digitcheckcodeis7,whichisaggregatedinto123456789012345677.

TheformulaoftheweightingfactorisWi=2^(n-1)(mod11),wherenisthenumbersequencestartingfrom1fromrighttoleft.

Sequence

ai12345678901234567?

Wi79105842163791058421

OrganizationCheckCode

Thenationalorganizationcodeconsistsofeightdigits(oruppercaseLatinletters)bodycodeandonedigit(OruppercaseLatinletters)checkcode.Thecheckcodeiscalculatedaccordingtothefollowingformula:

8

C9=11-MOD(∑Ci×Wi,11)

i=1

MOD-representingtheremainderfunction;i-representingthepositionnumberofthecodecharacterfromlefttoright;

Ci-representingthevalueofthecodecharacteratthei-thposition,listedinthefollowing"codecharacterset"Characters;

C9-indicatingcheckcode;

Wi-indicatingtheweightingfactoratthei-thposition,thevalues​​areasfollows:

weightingfactor

p>

i

1

2

3

4

5

6

7

8

Wi

3

7

9

10

5

8

4

2

WhentheMODfunctionvalueWhenitis1(ieC9=10),thecheckcodeshouldberepresentedbythecapitalLatinletter“X”;whentheMODfunctionvalueis0(ieC9=11),thecheckcodeisstillrepresentedby“0”;whenthevalueofC9Whenitis1to9,thecheckcodeisdirectlyrepresentedbythevalueofC9.

See

  • Checkcodesystem

  • Redundancycheck

Related Articles
TOP