<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DotBert &#187; bsn</title>
	<atom:link href="http://dotbert.loedeman.nl/category/bsn/feed" rel="self" type="application/rss+xml" />
	<link>http://dotbert.loedeman.nl</link>
	<description>.NET thoughts by Bert Loedeman</description>
	<lastBuildDate>Wed, 19 Oct 2011 07:57:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Dutch social security number check</title>
		<link>http://dotbert.loedeman.nl/dutch-social-security-number-check</link>
		<comments>http://dotbert.loedeman.nl/dutch-social-security-number-check#comments</comments>
		<pubDate>Thu, 20 Nov 2008 12:15:00 +0000</pubDate>
		<dc:creator>Bert Loedeman</dc:creator>
				<category><![CDATA[11-proef]]></category>
		<category><![CDATA[bsn]]></category>
		<category><![CDATA[burgerservicenummer]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[elfproef]]></category>
		<category><![CDATA[social security number]]></category>

		<guid isPermaLink="false">http://www.loedeman.net/wordpress/?p=24</guid>
		<description><![CDATA[For a Dutch customer I currently work for, I dealed with an incorrect social security number check (in Dutch: elfproef voor BSN&#8217;s/burgerservicenummers). After checking out the Internet for the correct definition of Dutch social security numbers (e.g. Burgerservicenummer &#8211; Wikipedia), I created the next check in C#: Good luck when you should build one for [...]]]></description>
			<content:encoded><![CDATA[<p>For a Dutch customer I currently work for, I dealed with an incorrect social security number check (in Dutch: elfproef voor BSN&#8217;s/burgerservicenummers). After checking out the Internet for the correct definition of Dutch social security numbers (e.g. <a href="http://nl.wikipedia.org/wiki/Burgerservicenummer">Burgerservicenummer &#8211; Wikipedia</a>), I created the next check in C#:</p>
<pre class="brush: csharp; title: ; notranslate">
string cleanBsnNr = bsnNr.Trim().Replace(&quot;.&quot;, &quot;&quot;);

// A BSN consists of 9 characters ...
if(cleanBsnNr.Length != 9) return false;

// ... all being numeric and not resulting in a 0 when converted to a number ...
long l;
if(!long.TryParse(cleanBsnNr, out l)) return false;
else if(l == 0) return false;

// ... the number must be validatable to the so-called 11-proof ...
long total = 0;
for(int i = 1; i &lt;= 9; i++)
{
    // 11-proof voor BSN's: (9*A + 8*B + 7*C + 6*D + 5*E + 4*F + 3*G + 2*H + (-1*I)) % 11 == 0
    int number = Convert.ToInt32(cleanBsnNr[i - 1].ToString());
    int multiplier = 10 - i;
    if(i == 9) multiplier = -1 * multiplier;

    total += number * multiplier;
}

// ... not result in a 0 when dividing by 11 ...
if(total == 0) return false;

// ... and not have a modulo when dividing by 11.
return total % 11 == 0;
</pre>
<p>Good luck when you should build one for yourself. Checking your own built check can be done using <a href="http://cgi.dit.nl/sofi.cgi">this website</a> with generated BSN&#8217;s (or your own, of course) by <a href="http://www.wilmans.com/sofinummer/">Menno Wilmans</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dotbert.loedeman.nl/dutch-social-security-number-check/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

