I am always having to deal with a lot of NRIC numbers in the course of my volunteer work with SINDA as a Centre Administrator at Pioneer STEP Centre. On one occasion recently, I was faced with one applicant who had entered his NRIC suffix incorrectly and I couldn't get through to the parent to verify.
Naturally, I turned to the internet for help and came across a few reverse-engineering findings of the algorithm used to calculate the suffix of our NRIC numbers. Whilst there is an 'exe' file for checking NRICs, I felt something non-intrusive such as an Excel document would be better. So, I have created one which can do the job and thrown in the checks for FIN numbers as well.
Licence is free to use (of course) but do credit the source of this particular creation (me) and I would appreciate if the contents were left unchanged, thanks.
For those interested, all the identification numbers use the Modulo 11 Checksum algorithm with the NRIC S-series corresponding to the FIN F-series (each uses a different set of suffix letters). The NRIC T-series just shifts the letters by four spaces from the S-series as does the FIN G-series from the F-series.
Finally, a word of caution. NRIC and FIN numbers are sensitive information and I do not endorse the use of this document for criminal, illegal or any non-genuine purpose.
Update:
After a call I received from one 'less than satisfied customer' who used the NRIC Checker, I realised that the following information is necessary. Please do not save the file at any point. There are formulas within the Excel document to calculate the values and display the appropriate suffix. However, if the cells with the formulas are altered, then obviously the checker will not function as it should.
If you find that the suffix is no longer being displayed whilst in use, simply close the file - click 'No' when asked to save the file - and then reopen it to try again. If at all the Checker does not seem to function at all, then delete the file completely and download a fresh copy to try again.
I have verified the file integrity and am certain that it works accurately.
Update ++:
As the comments section show, I was advised to protect the document in order to avoid problems for users - which I have duly done. So for those with the Midas Touch with regard to messes, well this should solve the problem. The only cells that can now be accessed in the protected state are the cells where you would need to enter the digits of the NRIC/FIN number, enjoy (hopefully).
Update +++:
From the kind contribution (see comments) of a reader, Nighthound, the 'checker' now includes vehicle registration numbers as well!
This entry has also been featured on the highly-popular tomorrow.sg so I guess I'm a little (in)famous now, hahaha. Thanks to the moderators jseng and Agagooga for approving this post as worthy.
Finally, a word of caution. NRIC and FIN numbers are sensitive information and I do not endorse the use of this document for criminal, illegal or any non-genuine purpose.
Update:
After a call I received from one 'less than satisfied customer' who used the NRIC Checker, I realised that the following information is necessary. Please do not save the file at any point. There are formulas within the Excel document to calculate the values and display the appropriate suffix. However, if the cells with the formulas are altered, then obviously the checker will not function as it should.
If you find that the suffix is no longer being displayed whilst in use, simply close the file - click 'No' when asked to save the file - and then reopen it to try again. If at all the Checker does not seem to function at all, then delete the file completely and download a fresh copy to try again.
I have verified the file integrity and am certain that it works accurately.
Update ++:
As the comments section show, I was advised to protect the document in order to avoid problems for users - which I have duly done. So for those with the Midas Touch with regard to messes, well this should solve the problem. The only cells that can now be accessed in the protected state are the cells where you would need to enter the digits of the NRIC/FIN number, enjoy (hopefully).
Update +++:
From the kind contribution (see comments) of a reader, Nighthound, the 'checker' now includes vehicle registration numbers as well!
This entry has also been featured on the highly-popular tomorrow.sg so I guess I'm a little (in)famous now, hahaha. Thanks to the moderators jseng and Agagooga for approving this post as worthy.
Update (Bug Fix):
Take note that there was a bug in the original checker such that the suffix 'I' and 'J' (S-series) would not appear, with the corresponding suffix letters for the other series affected as well. Due to an alert from Nighthound, I was able to correct the errors and the latest file appears on this blog. I truly apologise for the oversight and humbly ask anyone who finds any further bugs to either email me or leave a comment here, thank you.
Update (Bug Fix 2):
Not really a bug fix but more of an upgrade. From Kervin's advice (see comments below), I have incorporated an error check such that when more than one digit is input into one box, there is a message asking to check.
Update (Bug Fix 2):
Not really a bug fix but more of an upgrade. From Kervin's advice (see comments below), I have incorporated an error check such that when more than one digit is input into one box, there is a message asking to check.
32 comments:
Why don't you protect the document except for the cells needed for input?
Would stop screwups.
Thanks for the tip Agagooga. In my effort to keep it 'open source', I did not realise that I could simply protect the worksheet without having a password. The changes have been effected.
Hi, stumbled onto your post from Tomorrow. Just for completeness I made a similar spreadsheet checker for Vehicle Registration Plate numbers as well.
I don't have a blog, so I've just uploaded the file here:
Vehicle Registration Plate Checker
Hey nighthound, thanks for the additional code. I have incorproated it into the original document but kept the file name (NRIC-FIN) same so that no one will have trouble finding the file from elsewhere. At the same time, I've kept the original file and link as it appears in your comment so that everyone knows the development.
albert - thank you for your kind words, glad to have helped, cheers.
Is this legal?
Corr, it should be fairly legal as the Modulo 11 algorithm is not patented (to my knowledge).
Christoph, your site never opens up (I don't have any problems with other sites), thus the file cannot be acessed at the URL you have provided. You can send me the file through email and I'll put it up on the blog as well.
Nighthound,
Thanks for the car license plate checker!
Did you personally reverse-engineer it?
Or did you learn of it from LTA or somewhere?
I once tried to brute-force it with coefficients and modulos, but did not get anywhere.
And could never find it online, until now.
So THANKS
"corr said...
Is this legal?"
typical s'porean... buay tahan
So if someone keys in a random number to check for validity, that person can use it for identity theft?
Kaon: Actually I found the formula somewhere on the net long time ago, and so copied it onto my computer for future reference. But I couldn't find it any more so I decided to release back into public domain.
It's more tricky than NRIC because they leave out some letters, as well as the use of reverse modulo (the letters go backwards) for the final checksum... I don't think I would've been able to brute-force the formula. :)
Kaon, it never occurred to me about the vehicle regsitration number suffix, so kudos indeed to Nighthound for the contribution.
Anonymous @09 July 2008 22:14:00 SGT, Corr has a valid point which I myself considered carefully before releasing this little file into the public domain. I am offering this as a utility that helps people like me who deal with a large number of NRIC numbers and is done out of good faith.
Corr, although your point is valid, there are several other ways to obtain valid NRIC numbers and I even noted on one occasion where the full NRIC numbers of contest winners were published in an advertisement on ST. Besides, a random NRIC number is of not much use to commit identity theft. One would need other details such as DOB and address (at least) before anything can be done, I would assume.
corr: coincidentally, our previous comments have exactly the same post time.
as for your concern about identity theft, i don't think being able to generate the last letter is very crucial. after all, if the person has managed to get hold of the digits of someone's NRIC, he should have access to the last letter as well.
Besides, a random NRIC number is of not much use to commit identity theft. One would need other details such as DOB and address (at least) before anything can be done, I would assume.
Not to mention: name
Hahaha, yes that too. Do you think I can cover up the faux pas by saying "I didn't want to state the obvious"?
But seriously, when I made the comment, I was thinking of more direct uses of just the random NRIC numbers alone, and thought of the civil service portals such as PM2S which uses the NRIC number as the userid and the DOB as the password by default.
Hi,
Great job! keep it up :)
Will attempt to restate the Singapore car plate checksum in English for posterity.
SXY 1234 Z
Only 2 letters of the prefix are used in the checksum, for now, so discard the S.
The 2 relevant letters of prefix, X and Y should be converted to numeric value where A=1 and Z=26.
Coefficients (aka weights) for the 2 alphabetic prefix positions and the 4 numeric positions are:
position: weight
X : 9
Y : 4
1 : 5
2 : 4
3 : 3
4 : 2
multiply each position by its weight.
Sum up all the products,
Take MOD 19 of the sum. This is the checksum. Look up the letter according to this:
0 A
1 Z
2 Y
3 X
4 U
5 T
6 S
7 R
8 P
9 M
10 L
11 K
12 J
13 H
14 G
15 E
16 D
17 C
18 B
Or you can do "19 minus the mod19" and use a slightly different final lookup, but that's longwinded.
The last time I needed this, but did not have it, was when a drunk driver damaged my property and the CCTV picture quality was just at the verge of resolving the plate number. :(
The bastard was in a landrover discovery.
What's the difference between the formula for the S-series NRIC and for the T-series NRIC? And the FIN's.
Seems weights are the same:
2, 7, 6, 5, 4, 3, 2
Difference lies in the lookup from mod-result to letter.
Someone want to paste the lookup's here please?
kaon: yes you're right, the NRIC calculation is exactly the same for S/T/F/G, except with different lookups. I just did a quick modification of my vehicle check spreadsheet and made a NRIC checker as well.
NRIC Checker
I used a 2-dimensional lookup table so that I didn't need to have 4 different fields for the different prefixes.
Here's the 2D table in text for posterity. :)
(treat the underscores as whitespace, I was just trying to be lazy when preserving formatting)
_____S___T___F___G
_0___J___G___X___R
_1___Z___F___W___Q
_2___I___E___U___P
_3___H___D___T___N
_4___G___C___R___M
_5___F___B___Q___L
_6___E___A___P___K
_7___D___J___N___X
_8___C___Z___M___W
_9___B___I___L___U
10___A___H___K___T
Should be quite self-explanatory, select the correct column based on the letter prefix, then just use the mod-11 to get the checksum letter.
ganga: while coming up with my spreadsheet, I noticed there's a slight bug in yours. You used 11-mod(x) before doing the lookup, but your lookup checks 0-10 instead 1-11.
ie. if the modulo result is 0, then 11-0 = 11, but your if/else statements check for 0 instead of 11. You probably need to correct that. :P
It was basically a very logical and lateral transliteration of the alogrithm. I am hardly proficient at using the formula function of Excel and was happy to get the right result in the right place to start off.
When I expanded to include the T-series and FIN numbers, I realised that it was sort of backwards (I believe you refer to this as the 'lookup').
I can fully understand that this IS a bug and from a purist standpoint, it should be fixed whether it is causing a problem or not.
However, based on my aptitude at Excel use, I will subscribe to the philosophy of "if it ain't broke, don't fix it". Besides, it will take me more time than I really want to spend on this.
Nevertheless, I wish to thank you for contributing and trying to correct the inherent error and I promise to take a look at it if I have the time to do so.
I think many people have benefitted from the use of this utility and it wouldn't have been possible without such like-minded participants, cheers.
Footnote: One comment by payucash was removed due to it being an obvious SPAM comment.
What I'm saying is, currently the implementation is broken. There's no way for any S-series IC number to generate a checksum letter of J.
For example, S8034569 is supposed to have a checksum letter "J", but in your excel file, it appears as "0".
The same case for T-series ending with "G", F-series ending with "X" and G-series ending with "R".
I'm just bringing this up so that people will not use your file and run into the bug unknowingly.
Nighthound, I didn't understand what you were trying to tell me the first time round, sorry. I have found the bug and killed it.
In fact there was another bug for the 'I' lookup as I had referred the wrong cell for checksum 2. As I copied and pasted the formulae, this error followed through for the other 'checkers'. Have fixed both and hopefully, there are no more.
Thanks for working on this with me, really appreciate it.
hmm.. now it works
http://www.ngiam.net/NRIC/UIN-FIN%20Universal.xls
The site has some additional info on the algorithm and the car plate algorithm as well
http://www.ngiam.net
Christoph, thank you for the added information. I have deleted your earlier 2 comments as it refers to the same URL, hope you don't mind.
The website (ngiam.net) indeed has very good information on the NRIC number structure, algorithm and even has a PDF/PPT presentation about the whole concept.
In fact, I had come across this presentation during my own research on this subject matter and found it to be very useful myself.
Interesting Development
I was contacted by a reporter soon after the post and was interviewed today by her. She has asked if I could link her up with any 2 users of the 'checker' for their end-user (non-professional) review.
In the pursuit of impartiality and objectivity, I feel that, good or bad, the 2 persons who are interviewed with regard to this utility should be persons I do not personally know.
Hence, I would like to urge any of you who have used the 'checker' to contact me through email or leave your email contact details in a comment for me to reach you.
For general information, the reporter herself is not a technical specialist and would not understand an in depth critique of the 'checker'.
I appreciate everyone's contribution and am honoured that my simple effort has been recognised to this extent. I also hope that the reviewers will allow themselves to be named and identified to share the limelight, thank you.
Glad to know people found my hack useful. I've put a direct link to the Excel calculator on the home page (ngiam.net) so that it is easier to locate.
you can set "validation" to allows only "One Character" only per cell and prompt for error msg if user inputs more then 1 char in a cell.. another accuracy check function. Thanks
~KV~
Kervin, thank you for the advice. I have incorporated this into the document for a better 'checker', cheers!
You can purchase the NRIC / FIN algorithm from the ICA at a small price. http://www.ica.gov.sg
A reverse engineer algorithm cannot be 100% trusted unless it matches the algorithm provided by ICA. With no auditing on the implementation, companies who uses this excel carefully for critical business needs.
Refer to the below article from ICA for comments on this nric checker.
http://www.ica.gov.sg/news_details.aspx?nid=11660
Thank you for the cautionary advice. The reply from ICA had already been posted on my blog in a separate entry when it appeared in July this year.
In any case, as you have noted, I have explicitly reiterated that this tool is meant to make admin work simpler and is not intended for use in data-sensitive environments.
this sucks man
Whooa...I read ur handbook to policing.Interesting.I was myself a NPCO with Rochor NPC from 2001 - 2003 with Team Alpha.Well,indeed Central Div is the best place for a police officer to realise his fullest potential.Though Alpha is bustling with widespread crimes, I really learnt alot about people.And at times,I came acroos cases where I nearly shed my tears..Central Div will always remain as the place where it build up my confidence and self esteem.I wish u all the best Ganga....Thanks for sharing with us about policing life...
Woeeee this thing is awesome! well done and thanks for sharing your work!
Post a Comment