<?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>Soroush Dalili - Computer Security Is My Interest! &#187; کد ملی</title>
	<atom:link href="http://soroush.secproject.com/blog/tag/%da%a9%d8%af-%d9%85%d9%84%db%8c/feed/" rel="self" type="application/rss+xml" />
	<link>http://soroush.secproject.com/blog</link>
	<description>Soroush Dalili&#039;s blog - بلاگ سروش دلیلی</description>
	<lastBuildDate>Tue, 10 Jan 2012 22:54:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Iranian National ID Algorithm</title>
		<link>http://soroush.secproject.com/blog/2009/01/iranian-national-id-algorithm/</link>
		<comments>http://soroush.secproject.com/blog/2009/01/iranian-national-id-algorithm/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 14:42:37 +0000</pubDate>
		<dc:creator>Soroush Dalili</dc:creator>
				<category><![CDATA[Normal Posts]]></category>
		<category><![CDATA[National ID Code Algorithm]]></category>
		<category><![CDATA[National ID Code JavaScript]]></category>
		<category><![CDATA[الگوریتم کد ملی]]></category>
		<category><![CDATA[کد ملی]]></category>

		<guid isPermaLink="false">http://soroush.secproject.com/blog/?p=92</guid>
		<description><![CDATA[In Iran each person has a national code which is called “Code Melli” or “کد ملی”. And, its algorithm is very similar to ISBN algorithm: The rules are: 1- This number has 10 digits like: C[1] C[2] C[3] C[4] C[5] C[6] C[7] C[8] C[9] C[10] 2- 3 digits of left must not be equal to [...]]]></description>
			<content:encoded><![CDATA[<p>In Iran each person has a national code which is called “Code Melli” or “کد ملی”. And, its algorithm is very similar to ISBN algorithm:<br />
The rules are:<br />
1- This number has 10 digits like: C[1] C[2] C[3] C[4] C[5] C[6] C[7] C[8] C[9] C[10]<br />
2- 3 digits of left must not be equal to 000 (c[1]c[2]c[3]000)<br />
3- C[10] is a control digit (like ISBN algorithm)<br />
The formula to determine C[10] is:<br />
Let A = (C[1]*10)+ (C[2]*9)+ (C[3]*8)+ (C[4]*7)+ (C[5]*6)+ (C[6]*5)+ (C[7]*4)+ (C[8]*3)+ (C[9]*2)<br />
Let B = A MOD 11<br />
If B == 0 Then C[10]=B Else C[10] = 11-B<br />
This JavaScript function is useful to validation:</p>
<p style="padding-left: 30px;"><em>&lt;script&gt;</em><br />
<em>//&#8212;&#8212;&#8212;&#8212;&#8212; Begin Iranian national code checker function &#8212;&#8212;&#8212;&#8212;&#8212;<br />
// Usage: IsIRNationalCode(&#8216;Number&#8217;) Return -&gt; True-False<br />
// Copyright: Soroush Dalili &#8211; October 2008<br />
//<br />
/**<br />
* IsIRNationalCode is a function to validate Iranian National ID<br />
* @param  theNum National ID number as an input<br />
* @return true if the input number is a valid Iranian National ID, otherwise false<br />
*/<br />
function IsIRNationalCode(theNum)<br />
{<br />
if(theNum.length!=10)<br />
{<br />
return false;<br />
}<br />
else<br />
{<br />
if(theNum.substr(0,3)==&#8217;000&#8242;) return false;<br />
var check = 0;<br />
for(var i=0;i&lt; theNum.length;i++)<br />
{<br />
var num = theNum.substr(i,1);<br />
check += num*(10-i)<br />
}<br />
if(check%11)<br />
{<br />
return false;<br />
}<br />
else<br />
{<br />
return true;<br />
}<br />
}<br />
}<br />
// Copyright: Soroush Dalili &#8211; October 2008<br />
//&#8212;&#8212;&#8212;&#8212;&#8212; End Iranian national code checker function &#8212;&#8212;&#8212;&#8212;&#8212;<br />
</em>&lt;/script&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://soroush.secproject.com/blog/2009/01/iranian-national-id-algorithm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

