A National ID in my country consists of 14 digits: CYYMMDDXXZZZZ1C1

  • C refers to the century - 2 for those born between 1900 and 1999, 3 for those born between 2000 to 2099
  • YYMMDD - birth date
  • XX - state code (predefined set of state codes)
  • ZZZZ1 - four random numbers with Z1 being odd for male and even for female
  • C1 - check digit

I have thousands of valid National IDs. Is there a way to know which algorithm was used to generate the check digit and to verify a given sequence if it's a valid National ID?

Suppose that the random numbers are pseudorandom numbers. Is there a way to analyze those numbers to figure their bias and design an algorithm that results in a high number of shared outputs between it's outputs and the ones from the National ID's ZZZZ1 random numbers?

Edit#1:@Steffen Ullrich yes the above description is what the documentation of national ID says , as for the four digits ZZZZ1 I called them pseudo-random numbers but in a sense they aren't even close , they are actually numbers assigned based on the order of registration per birth date per state , as I understand the sex ration per state plus the population per age group per state will introduce some sort of a pattern , "add to that that human birth rate isn't uniform along the entire year - I couldn't really find any data for the last claim but at least in developing countries I believe it should be visible"

  • 1
    I don't understand: if the ZZZZ1 is really (pseudo)random then why would you need to generate similar numbers? There is no "similar" with random data. Are you sure that these data are supposed to be random? Because I don't see what sense this would make. And have you looked for documentation on the national ID instead of guessing? – Steffen Ullrich Nov 6 '15 at 18:20
  • 1
    Have you looked for the spec in your government website? Have you tried a few algorithms with known data such as your own ID? – lorenzog Nov 8 '15 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.