Thursday, March 15, 2007

More than a number: the National Id continued...


Rather than answer the oft asked question "what's in a name?" we should ask "what's in a number?"

Is there rhyme or reason in your id number (the social security number for Americans)? The Swedish National Id, mentioned in a previous post, full of structure. This post describes that structure. It is formed as follows:

Take your birth date, say March 13, 1962. Encode it as 620313. This constitutes the first 6 numbers.

Now append two digits corresponding to preassigned birthplaces. A special two digits were reserved for foreigners and for people born at home in Sweden. Obviously this means there are fewer than 99 possible birth places which is not true nowadays. Let's pretend you were born in a hospital in Stockholm that was assigned the number 37. Now our id is 63031337.

Then, you get one digit for birth number: odd number for males, even for females. Suppose you were the second male born that day, then your number would be 3. Now the ID is 630313373. Hospitals that had more than 5 males or 5 females born in a day got multiple hospital codes - the two "birth place" digits mentioned above.

We're not finished...

Now the interesting part. The last number is an error checking value (called a parity digit in the previous post). Here's how it's calculated:

So far the number in our example is 620313373. The error checking consist of several steps which are hard to describe in a blog, but here goes anyway....

Multiply the first, third, ... the odd digits by 2. Multiply the even ones (second, fourth, etc.) by 1.


6 2 0 3 1 3 3 7 3
x2 x1 x2 x1 x2 x1 x2 x1 x2
---------------------------
12 2 0 3 2 3 6 7 6


This pattern of alternating 2's and 1's prevents someone from switching two digits while typing them, a common human error. I doesn't work if the digits are identical but in that case who cares if they are switched!

We're still not done.

Now add all the digits on the last line:
1+2+2+0+3+2+3+6+7+6 = 32

I don't know what this step does but I know it has a purpose. When I find out, expect another post.

Now round up to the nearest decade. In our case, that would be 40. Subtract 32 from 40 to get 8. The last digit in the ID for this example would then be 8. The final ID is then 6203133738.

Now how are they accounting for the population boom and foreign influx. They are breaking the pattern a little: first the second pair of digits which correspond to the birth month would have only twelve values. Throw that away and allow all 100 possibilities. Similar for the day of the month. Rather than allow 01 to 31, permit all 100 possibilities.



Is there a similar structure with American social security numbers? Yes, there is some structure which is described in Wikipedia: chapter 3 under Social Security Number. If there had been more structure in our Id's, then the identity theives would know a lot more about us.

I have no idea about the re-use policy of either country. That is, when a person dies, is the number returned to the pool of available numbers?

The photo's are just in the theme of numbers. The top photo is the Nils Eriksson Bus Terminal in Göteborg (aka Gothenburg). The bottom image is from a store in Sweden. Neither picture is related to the National Id.

No comments: