<?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>Development &#8211; Hamza Siddiqui</title>
	<atom:link href="https://www.mhamzas.com/blog/tag/development/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.mhamzas.com</link>
	<description>4x Salesforce MVP &#124; 26x Certified &#124; Salesforce App &#38; System Architect</description>
	<lastBuildDate>Fri, 27 Mar 2020 09:12:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
<site xmlns="com-wordpress:feed-additions:1">233526040</site>	<item>
		<title>Check The Validity/Checksum of The Canadian SIN in Apex</title>
		<link>https://www.mhamzas.com/blog/2020/03/27/check-the-validity-checksum-of-the-canadian-sin-in-apex/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=check-the-validity-checksum-of-the-canadian-sin-in-apex</link>
					<comments>https://www.mhamzas.com/blog/2020/03/27/check-the-validity-checksum-of-the-canadian-sin-in-apex/#respond</comments>
		
		<dc:creator><![CDATA[hamza]]></dc:creator>
		<pubDate>Fri, 27 Mar 2020 09:12:44 +0000</pubDate>
				<category><![CDATA[Salesforce]]></category>
		<category><![CDATA[apex]]></category>
		<category><![CDATA[Development]]></category>
		<guid isPermaLink="false">https://www.mhamzas.com/?p=3078</guid>

					<description><![CDATA[In general, following is the method to check the validity and Checksum of Canadian SIN. Given an example Number:&#160;123 456 782 Remove the check digit (the last digit): 123456782 Extract the even digits (2,4,6,8th digit): 12345678 Double them: 2 4 6 8 <br /><a href="https://www.mhamzas.com/blog/2020/03/27/check-the-validity-checksum-of-the-canadian-sin-in-apex/" class="more-link btn btn-primary">Read More</a>]]></description>
										<content:encoded><![CDATA[
<p>In general, following is the method to check the validity and Checksum of Canadian SIN.</p>



<p>Given an example Number:&nbsp;<code>123 456 782</code></p>



<ol class="wp-block-list"><li>Remove the check digit (the last digit): <code>12345678<strong>2</strong></code></li><li>Extract the even digits (2,4,6,8th digit): <code>1<strong>2</strong>3<strong>4</strong>5<strong>6</strong>7<strong>8</strong></code></li><li>Double them:    <code>2  4  6  8</code>  &#8212;&#8212;&#8211;&gt;  <code>4  8  12 16</code>  </li><li>Add the digits together:<code>4+8+1+2+1+6 = 22</code></li><li>Add the Odd placed digits:    <code>1+3+5+7 = 16</code> &#8212;&gt; <strong><code>Total : 38</code></strong></li></ol>



<p><strong>Validity Algorithm</strong></p>



<ol class="wp-block-list"><li>If the total is a multiple of 10, the check digit should be zero.</li><li>Otherwise, Subtract the Total from the next highest multiple of 10 (40 in this case)</li><li>The check digit for this SIN must be equal to the difference of the number and the totals from earlier (in this case, <code>40-38 = 2</code>; check digit is 2, so the number is valid)</li></ol>



<p>In Apex, this logic will be like, </p>



<script src="https://gist.github.com/mhamzas/d81fd3b250b1062ced01f9dbdb32c798.js"></script>



<p>Source: <a href="https://stackoverflow.com/questions/4263398/how-do-i-check-the-validity-of-the-canadian-social-insurance-number-in-c">https://stackoverflow.com/questions/4263398/how-do-i-check-the-validity-of-the-canadian-social-insurance-number-in-c</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.mhamzas.com/blog/2020/03/27/check-the-validity-checksum-of-the-canadian-sin-in-apex/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3078</post-id>	</item>
	</channel>
</rss>
