<?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>Hoozi Resources</title>
	<atom:link href="http://www.hoozi.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hoozi.com</link>
	<description></description>
	<lastBuildDate>Fri, 19 Aug 2011 17:32:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Secure Hash Algorithm (SHA-1) Reference implementation in C/C++ with comments</title>
		<link>http://www.hoozi.com/posts/secure-hash-algorithm-sha-1-reference-implementation-in-cc-with-comments-2/</link>
		<comments>http://www.hoozi.com/posts/secure-hash-algorithm-sha-1-reference-implementation-in-cc-with-comments-2/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 17:30:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.hoozi.com/?p=289</guid>
		<description><![CDATA[The SHA-1 source code in C/C++ is given below. Comments are given in separate color. Download this source code from our download section. This html file may contain errors due to markup. &#160; /* ****************************************************************** This source code is under development. Even though you can use it as such, it is recommended you check back [...]]]></description>
			<content:encoded><![CDATA[<p>The SHA-1 source code in C/C++ is given below. Comments are given in separate color.</p>
<p>Download this source code from our <strong><a href="http://www.hoozi.com/downloads/">download section</a></strong>. This html file may contain errors due to markup.</p>
<p>&nbsp;</p>
<pre></pre>
<pre>/*</pre>
<pre>******************************************************************</pre>
<pre>This source code is under development. Even though you can use it as</pre>
<pre>such, it is recommended you check back after a few hours for an updated</pre>
<pre>version. The current version lacks descriptive comments also.</pre>
<pre>******************************************************************</pre>
<pre>*/</pre>
<pre></pre>
<pre>#include&lt;stdio.h&gt;</pre>
<pre>#include&lt;string.h&gt;</pre>
<pre>#include&lt;malloc.h&gt;</pre>
<pre>#include&lt;math.h&gt;</pre>
<pre>#include&lt;stdlib.h&gt;</pre>
<pre></pre>
<pre>#define rotateleft(x,n) ((x&lt;&lt;n) | (x&gt;&gt;(32-n)))</pre>
<pre>#define rotateright(x,n) ((x&gt;&gt;n) | (x&lt;&lt;(32-n)))</pre>
<pre></pre>
<pre>void SHA1(unsigned char * str1)</pre>
<pre>{</pre>
<pre>unsigned long int h0,h1,h2,h3,h4,a,b,c,d,e,f,k,temp;</pre>
<pre></pre>
<pre>h0 = 0x67452301;</pre>
<pre>h1 = 0xEFCDAB89;</pre>
<pre>h2 = 0x98BADCFE;</pre>
<pre>h3 = 0x10325476;</pre>
<pre>h4 = 0xC3D2E1F0;</pre>
<pre></pre>
<pre>unsigned char * str;</pre>
<pre>str = (unsigned char *)malloc(strlen((const char *)str1)+100);</pre>
<pre>strcpy((char *)str,(const char *)str1);</pre>
<pre></pre>
<pre>int current_length = strlen((const char *)str);</pre>
<pre>int original_length = current_length;</pre>
<pre>str[current_length] = 0x80;</pre>
<pre>str[current_length + 1] = '\0';</pre>
<pre></pre>
<pre>char ic = str[current_length];</pre>
<pre>current_length++;</pre>
<pre></pre>
<pre>int ib = current_length % 64;</pre>
<pre>if(ib&lt;56)</pre>
<pre>ib = 56-ib;</pre>
<pre>else</pre>
<pre>ib = 120 - ib;</pre>
<pre></pre>
<pre>for(int i=0;i &lt; ib;i++)</pre>
<pre>{</pre>
<pre>str[current_length]=0x00;</pre>
<pre>current_length++;</pre>
<pre>}</pre>
<pre>str[current_length + 1]='\0';</pre>
<pre></pre>
<pre>for(i=0;i&lt;6;i++)</pre>
<pre>{</pre>
<pre>str[current_length]=0x0;</pre>
<pre>current_length++;</pre>
<pre>}</pre>
<pre>str[current_length] = (original_length * <img src='http://www.hoozi.com/wordpress/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> / 0x100 ;</pre>
<pre>current_length++;</pre>
<pre>str[current_length] = (original_length * <img src='http://www.hoozi.com/wordpress/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> % 0x100;</pre>
<pre>current_length++;</pre>
<pre>str[current_length+i]='\0';</pre>
<pre>int number_of_chunks = current_length/64;</pre>
<pre>unsigned long int word[80];</pre>
<pre>for(i=0;i&lt;number_of_chunks;i++)</pre>
<pre>{</pre>
<pre>for(int j=0;j&lt;16;j++)</pre>
<pre>{</pre>
<pre>word[j] = str[i*64 + j*4 + 0] * 0x1000000 + str[i*64 + j*4 + 1] * 0x10000 + str[i*64 + j*4 + 2] * 0x100 + str[i*64 + j*4 + 3];</pre>
<pre>}</pre>
<pre>for(j=16;j&lt;80;j++)</pre>
<pre>{</pre>
<pre>word[j] = rotateleft((word[j-3] ^ word[j-8] ^ word[j-14] ^ word[j-16]),1);</pre>
<pre>}</pre>
<pre></pre>
<pre>a = h0;</pre>
<pre>b = h1;</pre>
<pre>c = h2;</pre>
<pre>d = h3;</pre>
<pre>e = h4;</pre>
<pre></pre>
<pre>for(int m=0;m&lt;80;m++)</pre>
<pre>{</pre>
<pre>if(m&lt;=19)</pre>
<pre>{</pre>
<pre>f = (b &amp; c) | ((~b) &amp; d);</pre>
<pre>k = 0x5A827999;</pre>
<pre>}</pre>
<pre>else if(m&lt;=39)</pre>
<pre>{</pre>
<pre>f = b ^ c ^ d;</pre>
<pre>k = 0x6ED9EBA1;</pre>
<pre>}</pre>
<pre></pre>
<pre>else if(m&lt;=59)</pre>
<pre>{</pre>
<pre>f = (b &amp; c) | (b &amp; d) | (c &amp; d);</pre>
<pre>k = 0x8F1BBCDC;</pre>
<pre>}</pre>
<pre></pre>
<pre>else</pre>
<pre>{</pre>
<pre>f = b ^ c ^ d;</pre>
<pre>k = 0xCA62C1D6;</pre>
<pre>}</pre>
<pre></pre>
<pre>temp = (rotateleft(a,5) + f + e + k + word[m]) &amp; 0xFFFFFFFF;</pre>
<pre>e = d;</pre>
<pre>d = c;</pre>
<pre>c = rotateleft(b,30);</pre>
<pre>b = a;</pre>
<pre>a = temp;</pre>
<pre></pre>
<pre>}</pre>
<pre></pre>
<pre>h0 = h0 + a;</pre>
<pre>h1 = h1 + b;</pre>
<pre>h2 = h2 + c;</pre>
<pre>h3 = h3 + d;</pre>
<pre>h4 = h4 + e;</pre>
<pre></pre>
<pre>}</pre>
<pre></pre>
<pre>printf("\n\n");</pre>
<pre>printf("Hash: %x %x %x %x %x",h0, h1, h2, h3, h4);</pre>
<pre>printf("\n\n");</pre>
<pre>}</pre>
<pre></pre>
<pre>void main()</pre>
<pre>{</pre>
<pre>SHA1((unsigned char *)"The quick brown fox jumps over the lazy dog");</pre>
<pre>}</pre>
<pre></pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p style="text-align: center;">&#8211; End of Source code &#8211;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;"><strong>License</strong>: No license. You are free to use this as you like.</p>
<p style="text-align: center;">Anyway if you use this source code, it would be nice if you could link back to us or give credit to the author.</p>
<p style="text-align: center;">Lot of work has gone into the development of this work. Anyway, thank you for visiting.</p>
<p style="text-align: center;"><strong>Author</strong>: Niyaz PK</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hoozi.com/posts/secure-hash-algorithm-sha-1-reference-implementation-in-cc-with-comments-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced Encryption Standard (AES)  Implementation in C/C++ with comments.  Part 2: Decryption</title>
		<link>http://www.hoozi.com/posts/advanced-encryption-standard-aes-implementation-in-cc-with-comments-part-2-decryption/</link>
		<comments>http://www.hoozi.com/posts/advanced-encryption-standard-aes-implementation-in-cc-with-comments-part-2-decryption/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 17:22:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.hoozi.com/?p=281</guid>
		<description><![CDATA[&#60;&#60; Part 1: Encryption The AES decryption source code in C/C++ is given below. Comments are given in separate color. Download this source code from our download section. This html file may contain errors due to markup. &#160; &#160; /* ****************************************************************** **       Advanced Encryption Standard implementation in C.      ** **       By Niyaz PK                                            ** **       [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.hoozi.com/posts/advanced-encryption-standard-aes-implementation-in-cc-with-comments-part-1-encryption/">&lt;&lt; Part 1: Encryption</a></p>
<p style="text-align: center;">The AES decryption source code in C/C++ is given below. Comments are given in separate color.</p>
<p style="text-align: center;">Download this source code from our <strong><a href="http://www.hoozi.com/downloads/">download section</a></strong>. This html file may contain errors due to markup.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>/*</p>
<p>******************************************************************</p>
<p>**       Advanced Encryption Standard implementation in C.      **</p>
<p>**       By Niyaz PK                                            **</p>
<p>**       E-mail: niyazlife@gmail.com                            **</p>
<p>**       Downloaded from Website: www.hoozi.com                 **</p>
<p>******************************************************************</p>
<p>This is the source code for decryption using the latest AES algorithm.</p>
<p>AES algorithm is also called Rijndael algorithm. AES algorithm is</p>
<p>recommended for non-classified use by the National Institute of Standards</p>
<p>and Technology(NIST), USA. Now-a-days AES is being used for almost</p>
<p>all encryption applications all around the world.</p>
<p>&nbsp;</p>
<p>THE MAIN FEATURE OF THIS AES ENCRYPTION PROGRAM IS NOT EFFICIENCY; IT</p>
<p>IS SIMPLICITY AND READABILITY. THIS SOURCE CODE IS PROVIDED FOR ALL</p>
<p>TO UNDERSTAND THE AES ALGORITHM.</p>
<p>&nbsp;</p>
<p>Comments are provided as needed to understand the program. But the</p>
<p>user must read some AES documentation to understand the underlying</p>
<p>theory correctly.</p>
<p>&nbsp;</p>
<p>It is not possible to describe the complete AES algorithm in detail</p>
<p>here. For the complete description of the algorithm, point your</p>
<p>browser to:</p>
<p>http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf</p>
<p>&nbsp;</p>
<p>Find the Wikipedia page of AES at:</p>
<p>http://en.wikipedia.org/wiki/Advanced_Encryption_Standard</p>
<p>******************************************************************</p>
<p>*/</p>
<p>&nbsp;</p>
<p>// Include stdio.h for standard input/output.</p>
<p>// Used for giving output to the screen.</p>
<p>#include&lt;stdio.h&gt;</p>
<p>&nbsp;</p>
<p>// The number of columns comprising a state in AES. This is a constant in AES. Value=4</p>
<p>#define Nb 4</p>
<p>&nbsp;</p>
<p>// The number of rounds in AES Cipher. It is simply initiated to zero. The actual value is recieved in the program.</p>
<p>int Nr=0;</p>
<p>&nbsp;</p>
<p>// The number of 32 bit words in the key. It is simply initiated to zero. The actual value is recieved in the program.</p>
<p>int Nk=0;</p>
<p>&nbsp;</p>
<p>// in &#8211; it is the array that holds the CipherText to be decrypted.</p>
<p>// out &#8211; it is the array that holds the output of the for decryption.</p>
<p>// state &#8211; the array that holds the intermediate results during decryption.</p>
<p>unsigned char in[16], out[16], state[4][4];</p>
<p>&nbsp;</p>
<p>// The array that stores the round keys.</p>
<p>unsigned char RoundKey[240];</p>
<p>&nbsp;</p>
<p>// The Key input to the AES Program</p>
<p>unsigned char Key[32];</p>
<p>&nbsp;</p>
<p>int getSBoxInvert(int num)</p>
<p>{</p>
<p>int rsbox[256] =</p>
<p>{ 0&#215;52, 0&#215;09, 0x6a, 0xd5, 0&#215;30, 0&#215;36, 0xa5, 0&#215;38, 0xbf, 0&#215;40, 0xa3, 0x9e, 0&#215;81, 0xf3, 0xd7, 0xfb</p>
<p>, 0x7c, 0xe3, 0&#215;39, 0&#215;82, 0x9b, 0x2f, 0xff, 0&#215;87, 0&#215;34, 0x8e, 0&#215;43, 0&#215;44, 0xc4, 0xde, 0xe9, 0xcb</p>
<p>, 0&#215;54, 0x7b, 0&#215;94, 0&#215;32, 0xa6, 0xc2, 0&#215;23, 0x3d, 0xee, 0x4c, 0&#215;95, 0x0b, 0&#215;42, 0xfa, 0xc3, 0x4e</p>
<p>, 0&#215;08, 0x2e, 0xa1, 0&#215;66, 0&#215;28, 0xd9, 0&#215;24, 0xb2, 0&#215;76, 0x5b, 0xa2, 0&#215;49, 0x6d, 0x8b, 0xd1, 0&#215;25</p>
<p>, 0&#215;72, 0xf8, 0xf6, 0&#215;64, 0&#215;86, 0&#215;68, 0&#215;98, 0&#215;16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0&#215;65, 0xb6, 0&#215;92</p>
<p>, 0x6c, 0&#215;70, 0&#215;48, 0&#215;50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0&#215;15, 0&#215;46, 0&#215;57, 0xa7, 0x8d, 0x9d, 0&#215;84</p>
<p>, 0&#215;90, 0xd8, 0xab, 0&#215;00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0&#215;58, 0&#215;05, 0xb8, 0xb3, 0&#215;45, 0&#215;06</p>
<p>, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0&#215;02, 0xc1, 0xaf, 0xbd, 0&#215;03, 0&#215;01, 0&#215;13, 0x8a, 0x6b</p>
<p>, 0x3a, 0&#215;91, 0&#215;11, 0&#215;41, 0x4f, 0&#215;67, 0xdc, 0xea, 0&#215;97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0&#215;73</p>
<p>, 0&#215;96, 0xac, 0&#215;74, 0&#215;22, 0xe7, 0xad, 0&#215;35, 0&#215;85, 0xe2, 0xf9, 0&#215;37, 0xe8, 0x1c, 0&#215;75, 0xdf, 0x6e</p>
<p>, 0&#215;47, 0xf1, 0x1a, 0&#215;71, 0x1d, 0&#215;29, 0xc5, 0&#215;89, 0x6f, 0xb7, 0&#215;62, 0x0e, 0xaa, 0&#215;18, 0xbe, 0x1b</p>
<p>, 0xfc, 0&#215;56, 0x3e, 0x4b, 0xc6, 0xd2, 0&#215;79, 0&#215;20, 0x9a, 0xdb, 0xc0, 0xfe, 0&#215;78, 0xcd, 0x5a, 0xf4</p>
<p>, 0x1f, 0xdd, 0xa8, 0&#215;33, 0&#215;88, 0&#215;07, 0xc7, 0&#215;31, 0xb1, 0&#215;12, 0&#215;10, 0&#215;59, 0&#215;27, 0&#215;80, 0xec, 0x5f</p>
<p>, 0&#215;60, 0&#215;51, 0x7f, 0xa9, 0&#215;19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0&#215;93, 0xc9, 0x9c, 0xef</p>
<p>, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0&#215;83, 0&#215;53, 0&#215;99, 0&#215;61</p>
<p>, 0&#215;17, 0x2b, 0&#215;04, 0x7e, 0xba, 0&#215;77, 0xd6, 0&#215;26, 0xe1, 0&#215;69, 0&#215;14, 0&#215;63, 0&#215;55, 0&#215;21, 0x0c, 0x7d };</p>
<p>&nbsp;</p>
<p>return rsbox[num];</p>
<p>}</p>
<p>&nbsp;</p>
<p>int getSBoxValue(int num)</p>
<p>{</p>
<p>int sbox[256] =   {</p>
<p>//0     1    2      3     4    5     6     7      8    9     A      B    C     D     E     F</p>
<p>0&#215;63, 0x7c, 0&#215;77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0&#215;30, 0&#215;01, 0&#215;67, 0x2b, 0xfe, 0xd7, 0xab, 0&#215;76,</p>
<p>0xca, 0&#215;82, 0xc9, 0x7d, 0xfa, 0&#215;59, 0&#215;47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0&#215;72, 0xc0,</p>
<p>0xb7, 0xfd, 0&#215;93, 0&#215;26, 0&#215;36, 0x3f, 0xf7, 0xcc, 0&#215;34, 0xa5, 0xe5, 0xf1, 0&#215;71, 0xd8, 0&#215;31, 0&#215;15,</p>
<p>0&#215;04, 0xc7, 0&#215;23, 0xc3, 0&#215;18, 0&#215;96, 0&#215;05, 0x9a, 0&#215;07, 0&#215;12, 0&#215;80, 0xe2, 0xeb, 0&#215;27, 0xb2, 0&#215;75,</p>
<p>0&#215;09, 0&#215;83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0&#215;52, 0x3b, 0xd6, 0xb3, 0&#215;29, 0xe3, 0x2f, 0&#215;84,</p>
<p>0&#215;53, 0xd1, 0&#215;00, 0xed, 0&#215;20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0&#215;39, 0x4a, 0x4c, 0&#215;58, 0xcf,</p>
<p>0xd0, 0xef, 0xaa, 0xfb, 0&#215;43, 0x4d, 0&#215;33, 0&#215;85, 0&#215;45, 0xf9, 0&#215;02, 0x7f, 0&#215;50, 0x3c, 0x9f, 0xa8,</p>
<p>0&#215;51, 0xa3, 0&#215;40, 0x8f, 0&#215;92, 0x9d, 0&#215;38, 0xf5, 0xbc, 0xb6, 0xda, 0&#215;21, 0&#215;10, 0xff, 0xf3, 0xd2,</p>
<p>0xcd, 0x0c, 0&#215;13, 0xec, 0x5f, 0&#215;97, 0&#215;44, 0&#215;17, 0xc4, 0xa7, 0x7e, 0x3d, 0&#215;64, 0x5d, 0&#215;19, 0&#215;73,</p>
<p>0&#215;60, 0&#215;81, 0x4f, 0xdc, 0&#215;22, 0x2a, 0&#215;90, 0&#215;88, 0&#215;46, 0xee, 0xb8, 0&#215;14, 0xde, 0x5e, 0x0b, 0xdb,</p>
<p>0xe0, 0&#215;32, 0x3a, 0x0a, 0&#215;49, 0&#215;06, 0&#215;24, 0x5c, 0xc2, 0xd3, 0xac, 0&#215;62, 0&#215;91, 0&#215;95, 0xe4, 0&#215;79,</p>
<p>0xe7, 0xc8, 0&#215;37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0&#215;56, 0xf4, 0xea, 0&#215;65, 0x7a, 0xae, 0&#215;08,</p>
<p>0xba, 0&#215;78, 0&#215;25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0&#215;74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,</p>
<p>0&#215;70, 0x3e, 0xb5, 0&#215;66, 0&#215;48, 0&#215;03, 0xf6, 0x0e, 0&#215;61, 0&#215;35, 0&#215;57, 0xb9, 0&#215;86, 0xc1, 0x1d, 0x9e,</p>
<p>0xe1, 0xf8, 0&#215;98, 0&#215;11, 0&#215;69, 0xd9, 0x8e, 0&#215;94, 0x9b, 0x1e, 0&#215;87, 0xe9, 0xce, 0&#215;55, 0&#215;28, 0xdf,</p>
<p>0x8c, 0xa1, 0&#215;89, 0x0d, 0xbf, 0xe6, 0&#215;42, 0&#215;68, 0&#215;41, 0&#215;99, 0x2d, 0x0f, 0xb0, 0&#215;54, 0xbb, 0&#215;16 };</p>
<p>return sbox[num];</p>
<p>}</p>
<p>&nbsp;</p>
<p>// The round constant word array, Rcon[i], contains the values given by</p>
<p>// x to th e power (i-1) being powers of x (x is denoted as {02}) in the field GF(2^8)</p>
<p>// Note that i starts at 1, not 0).</p>
<p>int Rcon[255] = {</p>
<p>0x8d, 0&#215;01, 0&#215;02, 0&#215;04, 0&#215;08, 0&#215;10, 0&#215;20, 0&#215;40, 0&#215;80, 0x1b, 0&#215;36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a,</p>
<p>0x2f, 0x5e, 0xbc, 0&#215;63, 0xc6, 0&#215;97, 0&#215;35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0&#215;91, 0&#215;39,</p>
<p>0&#215;72, 0xe4, 0xd3, 0xbd, 0&#215;61, 0xc2, 0x9f, 0&#215;25, 0x4a, 0&#215;94, 0&#215;33, 0&#215;66, 0xcc, 0&#215;83, 0x1d, 0x3a,</p>
<p>0&#215;74, 0xe8, 0xcb, 0x8d, 0&#215;01, 0&#215;02, 0&#215;04, 0&#215;08, 0&#215;10, 0&#215;20, 0&#215;40, 0&#215;80, 0x1b, 0&#215;36, 0x6c, 0xd8,</p>
<p>0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0&#215;63, 0xc6, 0&#215;97, 0&#215;35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef,</p>
<p>0xc5, 0&#215;91, 0&#215;39, 0&#215;72, 0xe4, 0xd3, 0xbd, 0&#215;61, 0xc2, 0x9f, 0&#215;25, 0x4a, 0&#215;94, 0&#215;33, 0&#215;66, 0xcc,</p>
<p>0&#215;83, 0x1d, 0x3a, 0&#215;74, 0xe8, 0xcb, 0x8d, 0&#215;01, 0&#215;02, 0&#215;04, 0&#215;08, 0&#215;10, 0&#215;20, 0&#215;40, 0&#215;80, 0x1b,</p>
<p>0&#215;36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0&#215;63, 0xc6, 0&#215;97, 0&#215;35, 0x6a, 0xd4, 0xb3,</p>
<p>0x7d, 0xfa, 0xef, 0xc5, 0&#215;91, 0&#215;39, 0&#215;72, 0xe4, 0xd3, 0xbd, 0&#215;61, 0xc2, 0x9f, 0&#215;25, 0x4a, 0&#215;94,</p>
<p>0&#215;33, 0&#215;66, 0xcc, 0&#215;83, 0x1d, 0x3a, 0&#215;74, 0xe8, 0xcb, 0x8d, 0&#215;01, 0&#215;02, 0&#215;04, 0&#215;08, 0&#215;10, 0&#215;20,</p>
<p>0&#215;40, 0&#215;80, 0x1b, 0&#215;36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0&#215;63, 0xc6, 0&#215;97, 0&#215;35,</p>
<p>0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0&#215;91, 0&#215;39, 0&#215;72, 0xe4, 0xd3, 0xbd, 0&#215;61, 0xc2, 0x9f,</p>
<p>0&#215;25, 0x4a, 0&#215;94, 0&#215;33, 0&#215;66, 0xcc, 0&#215;83, 0x1d, 0x3a, 0&#215;74, 0xe8, 0xcb, 0x8d, 0&#215;01, 0&#215;02, 0&#215;04,</p>
<p>0&#215;08, 0&#215;10, 0&#215;20, 0&#215;40, 0&#215;80, 0x1b, 0&#215;36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0&#215;63,</p>
<p>0xc6, 0&#215;97, 0&#215;35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0&#215;91, 0&#215;39, 0&#215;72, 0xe4, 0xd3, 0xbd,</p>
<p>0&#215;61, 0xc2, 0x9f, 0&#215;25, 0x4a, 0&#215;94, 0&#215;33, 0&#215;66, 0xcc, 0&#215;83, 0x1d, 0x3a, 0&#215;74, 0xe8, 0xcb  };</p>
<p>&nbsp;</p>
<p>// This function produces Nb(Nr+1) round keys. The round keys are used in each round to decrypt the states.</p>
<p>void KeyExpansion()</p>
<p>{</p>
<p>int i,j;</p>
<p>unsigned char temp[4],k;</p>
<p>&nbsp;</p>
<p>// The first round key is the key itself.</p>
<p>for(i=0;i&lt;Nk;i++)</p>
<p>{</p>
<p>RoundKey[i*4]=Key[i*4];</p>
<p>RoundKey[i*4+1]=Key[i*4+1];</p>
<p>RoundKey[i*4+2]=Key[i*4+2];</p>
<p>RoundKey[i*4+3]=Key[i*4+3];</p>
<p>}</p>
<p>&nbsp;</p>
<p>// All other round keys are found from the previous round keys.</p>
<p>while (i &lt; (Nb * (Nr+1)))</p>
<p>{</p>
<p>for(j=0;j&lt;4;j++)</p>
<p>{</p>
<p>temp[j]=RoundKey[(i-1) * 4 + j];</p>
<p>}</p>
<p>if (i % Nk == 0)</p>
<p>{</p>
<p>// This function rotates the 4 bytes in a word to the left once.</p>
<p>// [a0,a1,a2,a3] becomes [a1,a2,a3,a0]</p>
<p>&nbsp;</p>
<p>// Function RotWord()</p>
<p>{</p>
<p>k = temp[0];</p>
<p>temp[0] = temp[1];</p>
<p>temp[1] = temp[2];</p>
<p>temp[2] = temp[3];</p>
<p>temp[3] = k;</p>
<p>}</p>
<p>&nbsp;</p>
<p>// SubWord() is a function that takes a four-byte input word and</p>
<p>// applies the S-box to each of the four bytes to produce an output word.</p>
<p>&nbsp;</p>
<p>// Function Subword()</p>
<p>{</p>
<p>temp[0]=getSBoxValue(temp[0]);</p>
<p>temp[1]=getSBoxValue(temp[1]);</p>
<p>temp[2]=getSBoxValue(temp[2]);</p>
<p>temp[3]=getSBoxValue(temp[3]);</p>
<p>}</p>
<p>&nbsp;</p>
<p>temp[0] =  temp[0] ^ Rcon[i/Nk];</p>
<p>}</p>
<p>else if (Nk &gt; 6 &amp;&amp; i % Nk == 4)</p>
<p>{</p>
<p>// Function Subword()</p>
<p>{</p>
<p>temp[0]=getSBoxValue(temp[0]);</p>
<p>temp[1]=getSBoxValue(temp[1]);</p>
<p>temp[2]=getSBoxValue(temp[2]);</p>
<p>temp[3]=getSBoxValue(temp[3]);</p>
<p>}</p>
<p>}</p>
<p>RoundKey[i*4+0] = RoundKey[(i-Nk)*4+0] ^ temp[0];</p>
<p>RoundKey[i*4+1] = RoundKey[(i-Nk)*4+1] ^ temp[1];</p>
<p>RoundKey[i*4+2] = RoundKey[(i-Nk)*4+2] ^ temp[2];</p>
<p>RoundKey[i*4+3] = RoundKey[(i-Nk)*4+3] ^ temp[3];</p>
<p>i++;</p>
<p>}</p>
<p>}</p>
<p>&nbsp;</p>
<p>// This function adds the round key to state.</p>
<p>// The round key is added to the state by an XOR function.</p>
<p>void AddRoundKey(int round)</p>
<p>{</p>
<p>int i,j;</p>
<p>for(i=0;i&lt;4;i++)</p>
<p>{</p>
<p>for(j=0;j&lt;4;j++)</p>
<p>{</p>
<p>state[j][i] ^= RoundKey[round * Nb * 4 + i * Nb + j];</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>&nbsp;</p>
<p>// The SubBytes Function Substitutes the values in the</p>
<p>// state matrix with values in an S-box.</p>
<p>void InvSubBytes()</p>
<p>{</p>
<p>int i,j;</p>
<p>for(i=0;i&lt;4;i++)</p>
<p>{</p>
<p>for(j=0;j&lt;4;j++)</p>
<p>{</p>
<p>state[i][j] = getSBoxInvert(state[i][j]);</p>
<p>&nbsp;</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>&nbsp;</p>
<p>// The ShiftRows() function shifts the rows in the state to the left.</p>
<p>// Each row is shifted with different offset.</p>
<p>// Offset = Row number. So the first row is not shifted.</p>
<p>void InvShiftRows()</p>
<p>{</p>
<p>unsigned char temp;</p>
<p>&nbsp;</p>
<p>// Rotate first row 1 columns to right</p>
<p>temp=state[1][3];</p>
<p>state[1][3]=state[1][2];</p>
<p>state[1][2]=state[1][1];</p>
<p>state[1][1]=state[1][0];</p>
<p>state[1][0]=temp;</p>
<p>&nbsp;</p>
<p>// Rotate second row 2 columns to right</p>
<p>temp=state[2][0];</p>
<p>state[2][0]=state[2][2];</p>
<p>state[2][2]=temp;</p>
<p>&nbsp;</p>
<p>temp=state[2][1];</p>
<p>state[2][1]=state[2][3];</p>
<p>state[2][3]=temp;</p>
<p>&nbsp;</p>
<p>// Rotate third row 3 columns to right</p>
<p>temp=state[3][0];</p>
<p>state[3][0]=state[3][1];</p>
<p>state[3][1]=state[3][2];</p>
<p>state[3][2]=state[3][3];</p>
<p>state[3][3]=temp;</p>
<p>}</p>
<p>&nbsp;</p>
<p>// xtime is a macro that finds the product of {02} and the argument to xtime modulo {1b}</p>
<p>#define xtime(x)   ((x&lt;&lt;1) ^ (((x&gt;&gt;7) &amp; 1) * 0x1b))</p>
<p>&nbsp;</p>
<p>// Multiplty is a macro used to multiply numbers in the field GF(2^8)</p>
<p>#define Multiply(x,y) (((y &amp; 1) * x) ^ ((y&gt;&gt;1 &amp; 1) * xtime(x)) ^ ((y&gt;&gt;2 &amp; 1) * xtime(xtime(x))) ^ ((y&gt;&gt;3 &amp; 1) * xtime(xtime(xtime(x)))) ^ ((y&gt;&gt;4 &amp; 1) * xtime(xtime(xtime(xtime(x))))))</p>
<p>&nbsp;</p>
<p>// MixColumns function mixes the columns of the state matrix.</p>
<p>// The method used to multiply may be difficult to understand for beginners.</p>
<p>// Please use the references to gain more information.</p>
<p>void InvMixColumns()</p>
<p>{</p>
<p>int i;</p>
<p>unsigned char a,b,c,d;</p>
<p>for(i=0;i&lt;4;i++)</p>
<p>{</p>
<p>&nbsp;</p>
<p>a = state[0][i];</p>
<p>b = state[1][i];</p>
<p>c = state[2][i];</p>
<p>d = state[3][i];</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>state[0][i] = Multiply(a, 0x0e) ^ Multiply(b, 0x0b) ^ Multiply(c, 0x0d) ^ Multiply(d, 0&#215;09);</p>
<p>state[1][i] = Multiply(a, 0&#215;09) ^ Multiply(b, 0x0e) ^ Multiply(c, 0x0b) ^ Multiply(d, 0x0d);</p>
<p>state[2][i] = Multiply(a, 0x0d) ^ Multiply(b, 0&#215;09) ^ Multiply(c, 0x0e) ^ Multiply(d, 0x0b);</p>
<p>state[3][i] = Multiply(a, 0x0b) ^ Multiply(b, 0x0d) ^ Multiply(c, 0&#215;09) ^ Multiply(d, 0x0e);</p>
<p>}</p>
<p>}</p>
<p>&nbsp;</p>
<p>// InvCipher is the main function that decrypts the CipherText.</p>
<p>void InvCipher()</p>
<p>{</p>
<p>int i,j,round=0;</p>
<p>&nbsp;</p>
<p>//Copy the input CipherText to state array.</p>
<p>for(i=0;i&lt;4;i++)</p>
<p>{</p>
<p>for(j=0;j&lt;4;j++)</p>
<p>{</p>
<p>state[j][i] = in[i*4 + j];</p>
<p>}</p>
<p>}</p>
<p>&nbsp;</p>
<p>// Add the First round key to the state before starting the rounds.</p>
<p>AddRoundKey(Nr);</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>// There will be Nr rounds.</p>
<p>// The first Nr-1 rounds are identical.</p>
<p>// These Nr-1 rounds are executed in the loop below.</p>
<p>for(round=Nr-1;round&gt;0;round&#8211;)</p>
<p>{</p>
<p>InvShiftRows();</p>
<p>InvSubBytes();</p>
<p>AddRoundKey(round);</p>
<p>InvMixColumns();</p>
<p>}</p>
<p>&nbsp;</p>
<p>// The last round is given below.</p>
<p>// The MixColumns function is not here in the last round.</p>
<p>InvShiftRows();</p>
<p>InvSubBytes();</p>
<p>AddRoundKey(0);</p>
<p>&nbsp;</p>
<p>// The decryption process is over.</p>
<p>// Copy the state array to output array.</p>
<p>for(i=0;i&lt;4;i++)</p>
<p>{</p>
<p>for(j=0;j&lt;4;j++)</p>
<p>{</p>
<p>out[i*4+j]=state[j][i];</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>void main()</p>
<p>{</p>
<p>int i;</p>
<p>&nbsp;</p>
<p>// Receive the length of key here.</p>
<p>while(Nr!=128 &amp;&amp; Nr!=192 &amp;&amp; Nr!=256)</p>
<p>{</p>
<p>printf(&#8220;Enter the length of Key(128, 192 or 256 only): &#8220;);</p>
<p>scanf(&#8220;%d&#8221;,&amp;Nr);</p>
<p>}</p>
<p>// Calculate Nk and Nr from the received value.</p>
<p>Nk = Nr / 32;</p>
<p>Nr = Nk + 6;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>// Part 1 is for demonstrative purpose. The key and plaintext are given in the program itself.</p>
<p>//     Part 1: ********************************************************</p>
<p>&nbsp;</p>
<p>// The array temp stores the key.</p>
<p>// The array temp2 stores the plaintext.</p>
<p>unsigned char temp[32] = {0&#215;00  ,0&#215;01  ,0&#215;02  ,0&#215;03  ,0&#215;04  ,0&#215;05  ,0&#215;06  ,0&#215;07  ,0&#215;08  ,0&#215;09  ,0x0a  ,0x0b  ,0x0c  ,0x0d  ,0x0e  ,0x0f};</p>
<p>unsigned char temp2[16]= {0&#215;69  ,0xc4  ,0xe0  ,0xd8  ,0x6a  ,0x7b  ,0&#215;04  ,0&#215;30  ,0xd8  ,0xcd  ,0xb7  ,0&#215;80  ,0&#215;70  ,0xb4  ,0xc5  ,0x5a};</p>
<p>&nbsp;</p>
<p>// Copy the Key and CipherText</p>
<p>for(i=0;i&lt;Nk*4;i++)</p>
<p>{</p>
<p>Key[i]=temp[i];</p>
<p>in[i]=temp2[i];</p>
<p>}</p>
<p>&nbsp;</p>
<p>//           *********************************************************</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>// Uncomment Part 2 if you need to read Key and CipherText from the keyboard.</p>
<p>//     Part 2: ********************************************************</p>
<p>/*</p>
<p>//Clear the input buffer</p>
<p>flushall();</p>
<p>&nbsp;</p>
<p>//Recieve the Key from the user</p>
<p>printf(&#8220;Enter the Key in hexadecimal: &#8220;);</p>
<p>for(i=0;i&lt;Nk*4;i++)</p>
<p>{</p>
<p>scanf(&#8220;%x&#8221;,&amp;Key[i]);</p>
<p>}</p>
<p>&nbsp;</p>
<p>printf(&#8220;Enter the CipherText in hexadecimal: &#8220;);</p>
<p>for(i=0;i&lt;Nb*4;i++)</p>
<p>{</p>
<p>scanf(&#8220;%x&#8221;,&amp;in[i]);</p>
<p>}</p>
<p>*/</p>
<p>//             ********************************************************</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>//The Key-Expansion routine must be called before the decryption routine.</p>
<p>KeyExpansion();</p>
<p>&nbsp;</p>
<p>// The next function call decrypts the CipherText with the Key using AES algorithm.</p>
<p>InvCipher();</p>
<p>&nbsp;</p>
<p>// Output the decrypted text.</p>
<p>printf(&#8220;\nText after decryption:\n&#8221;);</p>
<p>for(i=0;i&lt;Nb*4;i++)</p>
<p>{</p>
<p>printf(&#8220;%02x &#8220;,out[i]);</p>
<p>}</p>
<p>printf(&#8220;\n\n&#8221;);</p>
<p>&nbsp;</p>
<p>}</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p style="text-align: center;">&#8211; End of Source code &#8211;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;"><strong>License</strong>: No license. You are free to use this as you like.</p>
<p style="text-align: center;">Anyway if you use this source code, it would be nice if you could link back to us or give credit to the author.</p>
<p style="text-align: center;">Lot of work has gone into the development of this work. Anyway, thank you for visiting.</p>
<p style="text-align: center;"><strong>Author</strong>: Niyaz PK</p>
<p style="text-align: center;">&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hoozi.com/posts/advanced-encryption-standard-aes-implementation-in-cc-with-comments-part-2-decryption/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced Encryption Standard (AES)  Implementation in C/C++ with comments.  Part 1: Encryption</title>
		<link>http://www.hoozi.com/posts/advanced-encryption-standard-aes-implementation-in-cc-with-comments-part-1-encryption/</link>
		<comments>http://www.hoozi.com/posts/advanced-encryption-standard-aes-implementation-in-cc-with-comments-part-1-encryption/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 17:01:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.hoozi.com/?p=269</guid>
		<description><![CDATA[Part 2: Decryption &#62;&#62; The AES encryption source code in C/C++ is given below. Comments are given in separate color. Download this source code from our download section. This html file may contain errors due to markup. &#160; /* ****************************************************************** **       Advanced Encryption Standard implementation in C.      ** **       By Niyaz PK                                            ** **       E-mail: [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.hoozi.com/posts/advanced-encryption-standard-aes-implementation-in-cc-with-comments-part-2-decryption/">Part 2: Decryption &gt;&gt;</a></p>
<p style="text-align: center;">The AES encryption source code in C/C++ is given below. Comments are given in separate color.</p>
<p style="text-align: center;">Download this source code from our <strong><a href="http://www.hoozi.com/downloads/">download section</a></strong>. This html file may contain errors due to markup.</p>
<p style="text-align: center;">&nbsp;</p>
<pre>/*</pre>
<pre>******************************************************************</pre>
<pre>**       Advanced Encryption Standard implementation in C.      **</pre>
<pre>**       By Niyaz PK                                            **</pre>
<pre>**       E-mail: niyazlife@gmail.com                            **</pre>
<pre>**       Downloaded from Website: www.hoozi.com                 **</pre>
<pre>******************************************************************</pre>
<pre>This is the source code for encryption using the latest AES algorithm.</pre>
<pre>AES algorithm is also called Rijndael algorithm. AES algorithm is</pre>
<pre>recommended for non-classified use by the National Institute of Standards</pre>
<pre>and Technology(NIST), USA. Now-a-days AES is being used for almost</pre>
<pre>all encryption applications all around the world.</pre>
<pre>THE MAIN FEATURE OF THIS AES ENCRYPTION PROGRAM IS NOT EFFICIENCY; IT</pre>
<pre>IS SIMPLICITY AND READABILITY. THIS SOURCE CODE IS PROVIDED FOR ALL</pre>
<pre>TO UNDERSTAND THE AES ALGORITHM.</pre>
<pre>Comments are provided as needed to understand the program. But the</pre>
<pre>user must read some AES documentation to understand the underlying</pre>
<pre>theory correctly.</pre>
<pre>It is not possible to describe the complete AES algorithm in detail</pre>
<pre>here. For the complete description of the algorithm, point your</pre>
<pre>browser to:</pre>
<pre>http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf</pre>
<pre>Find the Wikipedia page of AES at:</pre>
<pre>http://en.wikipedia.org/wiki/Advanced_Encryption_Standard</pre>
<pre>******************************************************************</pre>
<pre>*/</pre>
<pre>// Include stdio.h for standard input/output.</pre>
<pre>// Used for giving output to the screen.</pre>
<pre>#include&lt;stdio.h&gt;</pre>
<pre>// The number of columns comprising a state in AES. This is a constant in AES. Value=4</pre>
<pre>#define Nb 4</pre>
<pre>// The number of rounds in AES Cipher. It is simply initiated to zero. The actual value is recieved in the program.</pre>
<pre>int Nr=0;</pre>
<pre>// The number of 32 bit words in the key. It is simply initiated to zero. The actual value is recieved in the program.</pre>
<pre>int Nk=0;</pre>
<pre>// in - it is the array that holds the plain text to be encrypted.</pre>
<pre>// out - it is the array that holds the output CipherText after encryption.</pre>
<pre>// state - the array that holds the intermediate results during encryption.</pre>
<pre>unsigned char in[16], out[16], state[4][4];</pre>
<pre>// The array that stores the round keys.</pre>
<pre>unsigned char RoundKey[240];</pre>
<pre>// The Key input to the AES Program</pre>
<pre>unsigned char Key[32];</pre>
<pre>int getSBoxValue(int num)</pre>
<pre>{</pre>
<pre>    int sbox[256] =   {</pre>
<pre>    //0     1    2      3     4    5     6     7      8    9     A      B    C     D     E     F</pre>
<pre>    0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, //0</pre>
<pre>    0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, //1</pre>
<pre>    0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, //2</pre>
<pre>    0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, //3</pre>
<pre>    0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, //4</pre>
<pre>    0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, //5</pre>
<pre>    0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, //6</pre>
<pre>    0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, //7</pre>
<pre>    0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, //8</pre>
<pre>    0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, //9</pre>
<pre>    0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, //A</pre>
<pre>    0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, //B</pre>
<pre>    0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, //C</pre>
<pre>    0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, //D</pre>
<pre>    0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, //E</pre>
<pre>    0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; //F</pre>
<pre>    return sbox[num];</pre>
<pre>}</pre>
<pre>// The round constant word array, Rcon[i], contains the values given by</pre>
<pre>// x to th e power (i-1) being powers of x (x is denoted as {02}) in the field GF(28)</pre>
<pre>// Note that i starts at 1, not 0).</pre>
<pre>int Rcon[255] = {</pre>
<pre>    0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a,</pre>
<pre>    0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39,</pre>
<pre>    0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a,</pre>
<pre>    0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8,</pre>
<pre>    0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef,</pre>
<pre>    0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc,</pre>
<pre>    0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b,</pre>
<pre>    0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3,</pre>
<pre>    0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94,</pre>
<pre>    0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20,</pre>
<pre>    0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35,</pre>
<pre>    0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f,</pre>
<pre>    0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04,</pre>
<pre>    0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63,</pre>
<pre>    0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd,</pre>
<pre>    0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb  };</pre>
<pre>// This function produces Nb(Nr+1) round keys. The round keys are used in each round to encrypt the states.</pre>
<pre>void KeyExpansion()</pre>
<pre>{</pre>
<pre>    int i,j;</pre>
<pre>    unsigned char temp[4],k;</pre>
<pre>    // The first round key is the key itself.</pre>
<pre>    for(i=0;i&lt;Nk;i++)</pre>
<pre>    {</pre>
<pre>        RoundKey[i*4]=Key[i*4];</pre>
<pre>        RoundKey[i*4+1]=Key[i*4+1];</pre>
<pre>        RoundKey[i*4+2]=Key[i*4+2];</pre>
<pre>        RoundKey[i*4+3]=Key[i*4+3];</pre>
<pre>    }</pre>
<pre>    // All other round keys are found from the previous round keys.</pre>
<pre>    while (i &lt; (Nb * (Nr+1)))</pre>
<pre>    {</pre>
<pre>        for(j=0;j&lt;4;j++)</pre>
<pre>        {</pre>
<pre>            temp[j]=RoundKey[(i-1) * 4 + j];</pre>
<pre>        }</pre>
<pre>        if (i % Nk == 0)</pre>
<pre>        {</pre>
<pre>            // This function rotates the 4 bytes in a word to the left once.</pre>
<pre>            // [a0,a1,a2,a3] becomes [a1,a2,a3,a0]</pre>
<pre>            // Function RotWord()</pre>
<pre>            {</pre>
<pre>                k = temp[0];</pre>
<pre>                temp[0] = temp[1];</pre>
<pre>                temp[1] = temp[2];</pre>
<pre>                temp[2] = temp[3];</pre>
<pre>                temp[3] = k;</pre>
<pre>            }</pre>
<pre>            // SubWord() is a function that takes a four-byte input word and</pre>
<pre>            // applies the S-box to each of the four bytes to produce an output word.</pre>
<pre>            // Function Subword()</pre>
<pre>            {</pre>
<pre>                temp[0]=getSBoxValue(temp[0]);</pre>
<pre>                temp[1]=getSBoxValue(temp[1]);</pre>
<pre>                temp[2]=getSBoxValue(temp[2]);</pre>
<pre>                temp[3]=getSBoxValue(temp[3]);</pre>
<pre>            }</pre>
<pre>            temp[0] =  temp[0] ^ Rcon[i/Nk];</pre>
<pre>        }</pre>
<pre>        else if (Nk &gt; 6 &amp;&amp; i % Nk == 4)</pre>
<pre>        {</pre>
<pre>            // Function Subword()</pre>
<pre>            {</pre>
<pre>                temp[0]=getSBoxValue(temp[0]);</pre>
<pre>                temp[1]=getSBoxValue(temp[1]);</pre>
<pre>                temp[2]=getSBoxValue(temp[2]);</pre>
<pre>                temp[3]=getSBoxValue(temp[3]);</pre>
<pre>            }</pre>
<pre>        }</pre>
<pre>        RoundKey[i*4+0] = RoundKey[(i-Nk)*4+0] ^ temp[0];</pre>
<pre>        RoundKey[i*4+1] = RoundKey[(i-Nk)*4+1] ^ temp[1];</pre>
<pre>        RoundKey[i*4+2] = RoundKey[(i-Nk)*4+2] ^ temp[2];</pre>
<pre>        RoundKey[i*4+3] = RoundKey[(i-Nk)*4+3] ^ temp[3];</pre>
<pre>        i++;</pre>
<pre>    }</pre>
<pre>}</pre>
<pre>// This function adds the round key to state.</pre>
<pre>// The round key is added to the state by an XOR function.</pre>
<pre>void AddRoundKey(int round)</pre>
<pre>{</pre>
<pre>    int i,j;</pre>
<pre>    for(i=0;i&lt;4;i++)</pre>
<pre>    {</pre>
<pre>        for(j=0;j&lt;4;j++)</pre>
<pre>        {</pre>
<pre>            state[j][i] ^= RoundKey[round * Nb * 4 + i * Nb + j];</pre>
<pre>        }</pre>
<pre>    }</pre>
<pre>}</pre>
<pre>// The SubBytes Function Substitutes the values in the</pre>
<pre>// state matrix with values in an S-box.</pre>
<pre>void SubBytes()</pre>
<pre>{</pre>
<pre>    int i,j;</pre>
<pre>    for(i=0;i&lt;4;i++)</pre>
<pre>    {</pre>
<pre>        for(j=0;j&lt;4;j++)</pre>
<pre>        {</pre>
<pre>            state[i][j] = getSBoxValue(state[i][j]);</pre>
<pre>        }</pre>
<pre>    }</pre>
<pre>}</pre>
<pre>// The ShiftRows() function shifts the rows in the state to the left.</pre>
<pre>// Each row is shifted with different offset.</pre>
<pre>// Offset = Row number. So the first row is not shifted.</pre>
<pre>void ShiftRows()</pre>
<pre>{</pre>
<pre>    unsigned char temp;</pre>
<pre>    // Rotate first row 1 columns to left</pre>
<pre>    temp=state[1][0];</pre>
<pre>    state[1][0]=state[1][1];</pre>
<pre>    state[1][1]=state[1][2];</pre>
<pre>    state[1][2]=state[1][3];</pre>
<pre>    state[1][3]=temp;</pre>
<pre>    // Rotate second row 2 columns to left</pre>
<pre>    temp=state[2][0];</pre>
<pre>    state[2][0]=state[2][2];</pre>
<pre>    state[2][2]=temp;</pre>
<pre>    temp=state[2][1];</pre>
<pre>    state[2][1]=state[2][3];</pre>
<pre>    state[2][3]=temp;</pre>
<pre>    // Rotate third row 3 columns to left</pre>
<pre>    temp=state[3][0];</pre>
<pre>    state[3][0]=state[3][3];</pre>
<pre>    state[3][3]=state[3][2];</pre>
<pre>    state[3][2]=state[3][1];</pre>
<pre>    state[3][1]=temp;</pre>
<pre>}</pre>
<pre>// xtime is a macro that finds the product of {02} and the argument to xtime modulo {1b}</pre>
<pre>#define xtime(x)   ((x&lt;&lt;1) ^ (((x&gt;&gt;7) &amp; 1) * 0x1b))</pre>
<pre>// MixColumns function mixes the columns of the state matrix</pre>
<pre>// The method used may look complicated, but it is easy if you know the underlying theory.</pre>
<pre>// Refer the documents specified above.</pre>
<pre>void MixColumns()</pre>
<pre>{</pre>
<pre>    int i;</pre>
<pre>    unsigned char Tmp,Tm,t;</pre>
<pre>    for(i=0;i&lt;4;i++)</pre>
<pre>    {</pre>
<pre>        t=state[0][i];</pre>
<pre>        Tmp = state[0][i] ^ state[1][i] ^ state[2][i] ^ state[3][i] ;</pre>
<pre>        Tm = state[0][i] ^ state[1][i] ; Tm = xtime(Tm); state[0][i] ^= Tm ^ Tmp ;</pre>
<pre>        Tm = state[1][i] ^ state[2][i] ; Tm = xtime(Tm); state[1][i] ^= Tm ^ Tmp ;</pre>
<pre>        Tm = state[2][i] ^ state[3][i] ; Tm = xtime(Tm); state[2][i] ^= Tm ^ Tmp ;</pre>
<pre>        Tm = state[3][i] ^ t ; Tm = xtime(Tm); state[3][i] ^= Tm ^ Tmp ;</pre>
<pre>    }</pre>
<pre>}</pre>
<pre>// Cipher is the main function that encrypts the PlainText.</pre>
<pre>void Cipher()</pre>
<pre>{</pre>
<pre>    int i,j,round=0;</pre>
<pre>    //Copy the input PlainText to state array.</pre>
<pre>    for(i=0;i&lt;4;i++)</pre>
<pre>    {</pre>
<pre>        for(j=0;j&lt;4;j++)</pre>
<pre>        {</pre>
<pre>            state[j][i] = in[i*4 + j];</pre>
<pre>        }</pre>
<pre>    }</pre>
<pre>    // Add the First round key to the state before starting the rounds.</pre>
<pre>    AddRoundKey(0);</pre>
<pre>    // There will be Nr rounds.</pre>
<pre>    // The first Nr-1 rounds are identical.</pre>
<pre>    // These Nr-1 rounds are executed in the loop below.</pre>
<pre>    for(round=1;round&lt;Nr;round++)</pre>
<pre>    {</pre>
<pre>        SubBytes();</pre>
<pre>        ShiftRows();</pre>
<pre>        MixColumns();</pre>
<pre>        AddRoundKey(round);</pre>
<pre>    }</pre>
<pre>    // The last round is given below.</pre>
<pre>    // The MixColumns function is not here in the last round.</pre>
<pre>    SubBytes();</pre>
<pre>    ShiftRows();</pre>
<pre>    AddRoundKey(Nr);</pre>
<pre>    // The encryption process is over.</pre>
<pre>    // Copy the state array to output array.</pre>
<pre>    for(i=0;i&lt;4;i++)</pre>
<pre>    {</pre>
<pre>        for(j=0;j&lt;4;j++)</pre>
<pre>        {</pre>
<pre>            out[i*4+j]=state[j][i];</pre>
<pre>        }</pre>
<pre>    }</pre>
<pre>}</pre>
<pre>void main()</pre>
<pre>{</pre>
<pre>    int i;</pre>
<pre>    // Receive the length of key here.</pre>
<pre>    while(Nr!=128 &amp;&amp; Nr!=192 &amp;&amp; Nr!=256)</pre>
<pre>    {</pre>
<pre>        printf("Enter the length of Key(128, 192 or 256 only): ");</pre>
<pre>        scanf("%d",&amp;Nr);</pre>
<pre>    }</pre>
<pre>    // Calculate Nk and Nr from the received value.</pre>
<pre>    Nk = Nr / 32;</pre>
<pre>    Nr = Nk + 6;</pre>
<pre>// Part 1 is for demonstrative purpose. The key and plaintext are given in the program itself.</pre>
<pre>//     Part 1: ********************************************************</pre>
<pre>    // The array temp stores the key.</pre>
<pre>    // The array temp2 stores the plaintext.</pre>
<pre>    unsigned char temp[16] = {0x00  ,0x01  ,0x02  ,0x03  ,0x04  ,0x05  ,0x06  ,0x07  ,0x08  ,0x09  ,0x0a  ,0x0b  ,0x0c  ,0x0d  ,0x0e  ,0x0f};</pre>
<pre>    unsigned char temp2[16]= {0x00  ,0x11  ,0x22  ,0x33  ,0x44  ,0x55  ,0x66  ,0x77  ,0x88  ,0x99  ,0xaa  ,0xbb  ,0xcc  ,0xdd  ,0xee  ,0xff};</pre>
<pre>    // Copy the Key and PlainText</pre>
<pre>    for(i=0;i&lt;Nk*4;i++)</pre>
<pre>    {</pre>
<pre>        Key[i]=temp[i];</pre>
<pre>        in[i]=temp2[i];</pre>
<pre>    }</pre>
<pre>//           *********************************************************</pre>
<pre>// Uncomment Part 2 if you need to read Key and PlainText from the keyboard.</pre>
<pre>//     Part 2: ********************************************************</pre>
<pre>/*</pre>
<pre>    //Clear the input buffer</pre>
<pre>    flushall();</pre>
<pre>    //Recieve the Key from the user</pre>
<pre>    printf("Enter the Key in hexadecimal: ");</pre>
<pre>    for(i=0;i&lt;Nk*4;i++)</pre>
<pre>    {</pre>
<pre>        scanf("%x",&amp;Key[i]);</pre>
<pre>    }</pre>
<pre>    printf("Enter the PlainText in hexadecimal: ");</pre>
<pre>    for(i=0;i&lt;Nb*4;i++)</pre>
<pre>    {</pre>
<pre>        scanf("%x",&amp;in[i]);</pre>
<pre>    }</pre>
<pre>*/</pre>
<pre>//             ********************************************************</pre>
<pre>    // The KeyExpansion routine must be called before encryption.</pre>
<pre>    KeyExpansion();</pre>
<pre>    // The next function call encrypts the PlainText with the Key using AES algorithm.</pre>
<pre>    Cipher();</pre>
<pre>    // Output the encrypted text.</pre>
<pre>    printf("\nText after encryption:\n");</pre>
<pre>    for(i=0;i&lt;Nk*4;i++)</pre>
<pre>    {</pre>
<pre>        printf("%02x ",out[i]);</pre>
<pre>    }</pre>
<pre>    printf("\n\n");</pre>
<pre>}</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p style="text-align: center;">&#8211; End of Source code &#8211;</p>
<p style="text-align: center;">&nbsp;</p>
<p style="text-align: center;"><strong>License</strong>: No license. You are free to use this as you like.</p>
<p style="text-align: center;">Anyway if you use this source code, it would be nice if you could link back to us or give credit to the author.</p>
<p style="text-align: center;">Lot of work has gone into the development of this work. Anyway, thank you for visiting.</p>
<p style="text-align: center;"><strong>Author</strong>: Niyaz PK</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hoozi.com/posts/advanced-encryption-standard-aes-implementation-in-cc-with-comments-part-1-encryption/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IIS</title>
		<link>http://www.hoozi.com/posts/iis/</link>
		<comments>http://www.hoozi.com/posts/iis/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 16:00:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.hoozi.com/?p=258</guid>
		<description><![CDATA[This section gives troubleshooting information and help for some error messages. Problem: IIS not working: default website (or the www service) not starting (1717: interface not known) Solution: First enable the event log service and run it. Then try to run the www service]]></description>
			<content:encoded><![CDATA[<p>This section gives troubleshooting information and help for some error messages.</p>
<p><strong>Problem:</strong> IIS not working: default website (or the www service) not starting (1717: interface not known)</p>
<p><strong>Solution:</strong></p>
<p>First enable the event log service and run it. Then try to run the www service</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hoozi.com/posts/iis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compression and Decompression using LZW Algorithm</title>
		<link>http://www.hoozi.com/posts/compression-and-decompression-using-lzw-algorithm/</link>
		<comments>http://www.hoozi.com/posts/compression-and-decompression-using-lzw-algorithm/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 15:57:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.hoozi.com/?p=256</guid>
		<description><![CDATA[Compression is the art or Science which represents information in a compact form. Compression is the process of reducing the size of a file. The aim of the data compression is to reduce redundancy in stored or communicated data, thus increasing effective data density. Data compression has important application in the areas of file storage [...]]]></description>
			<content:encoded><![CDATA[<p>Compression is the art or Science which represents information in a compact form. Compression is the process of reducing the size of a file. The aim of the data compression is to reduce redundancy in stored or communicated data, thus increasing effective data density. Data compression has important application in the areas of file storage and distributed systems. Compression is used in the case of text, video, audio data etc. In audio and video compression it is used to reduce the number of bits required to represent an image or video.</p>
<p>Data Compression and Decompression is often referred to as coding, where coding is a very general term encompassing any special representation of data which satisfies a given need. Information theory is defined to be the study of effective coding and its consequences, in the form of speed of transmission and probability of errors. Data compression may be viewed as a branch of information theory in which the primary objective is to minimize the amount of memory that is to be used to store the data. The purpose of this is to present a data compression and decompression software to reduce the amount memory used for storing data</p>
<p>There are mainly two types of compression methods are used: lossless compression and lossy compression</p>
<p>In lossless compression there is no loss of data during compression and decompression. It is mainly used in compressing text documents because in documents if it losses even a bit of data or if there is a change in word it becomes a large change in the meaning. Example for lossless compression is  Arithmetic coding, Substitutional Compressors, Huffman coding etc.</p>
<p>In lossy compression there is a lose of data during compression. It is mainly used in video compression etc.. In this, we change some features of the picture or video for compression so there a loss of actual data. So we cant get the exact decompressed file. Eg: Audio compression, Fractal compression etc. In lossy compression the compression rate is higher than that of lossless compression. But it is least efficient</p>
<p>There are many compression techniques used for many applications but only the most commonly used and simplest compression and decompression technique that is  LZW compression algorithm is explained here.</p>
<p>&nbsp;</p>
<p><strong>1.  LZW Compression and Decompression</strong></p>
<p>This is the most commonly used and the simplest type of compression and decompression algorithm. The original Lempel Ziv approach to data was published in 1977.Terry Welch’s refinements to the algorithm were published in 1984. This algorithm starts with a dictionary of characters. In this algorithm, it replaces strings of characters with single codes.</p>
<p>There are mainly two types of implementations in LZW compression. They are: Static and Dynamic.</p>
<p>&nbsp;</p>
<p><strong>1.1.   Static Compression</strong></p>
<p>It use when we use a static number of bits to make the compression. The total number of bits we have to our disposal is 32, which gives a total of 232 that is 4,294,967,295 possible entries in the dictionary. But in almost all cases we don’t get that much entries so most of the cases we use a constant number of bits commonly set the number of bits as 14. In 14 bit format ‘A ‘ is represented by 00000001000001.</p>
<p>&nbsp;</p>
<p><strong>1.2.   Dynamic Compression</strong></p>
<p>Dynamic compression changes the number of bits used to compress the data. It starts with 9 bits for each new value, and goes up until it reaches 32 or until the file ends. In this type of compression we can set the size of the dictionary we have. The dictionary begins with all the 256 ASCII codes. In dynamic compression there is only one leading 0 in front of each number. In dynamic compression ‘A’ is represented as 001000001.If we change the character in the ASCII to a string (group of characters) it changes the number of bits used to represent the string. Because when we use 9 bits only up to 255 is possible.</p>
<p>Advantage of dynamic compression over static compression is that we get a more compressed file when we use the former. The disadvantage is that the dynamic compression takes more time to compress a file. Even if it takes more time, the most commonly used method is dynamic compression.</p>
<p>&nbsp;</p>
<p><strong>2.  ALGORITHMS:</strong></p>
<p><strong>2.1.   LZW Algorithm for Compression</strong></p>
<p>The LZW Compression algorithm starts with a “Dictionary” of all the single characters with indexes 0-255. It then starts to expand the dictionary as information get sent through. The redundant strings will be coded as a single bit so the compression has occurred.</p>
<p><strong>Algorithm</strong></p>
<p>STRING = get input character</p>
<p>WHILE there are still input characters DO</p>
<p>CHARACTER = get input character</p>
<p>IF STRING + CHARACTER is in the string table then</p>
<p>STRING = STRING + CHARACTER</p>
<p>ELSE</p>
<p>output the code for STRING</p>
<p>add STRING + CHARACTER to the string table</p>
<p>STRING = CHARACTER</p>
<p>END of IF</p>
<p>END of WHILE</p>
<p>output the code for STRING</p>
<p>&nbsp;</p>
<p>The program reads one character at a time. If the code is in the dictionary, then it adds the character to the current work string, and waits for the next one. This occurs on the first character as well. If the work string is not in the dictionary, (such as when the second character comes across), it adds the work string to the dictionary and sends over the wire the work string without the new character. It then sets the work string to the new character.</p>
<p>&nbsp;</p>
<p><strong>Explanation with Example</strong></p>
<p>&nbsp;</p>
<p>A sample string used to demonstrate the algorithm is shown in Figure 1. Add all ASCII characters in the table from 0-255. you can see that the first pass through the loop, a check is performed to see if the string &#8220;/A&#8221; is in the table. Since it isn&#8217;t, the code for &#8216;/&#8217; is output, and the string &#8220;/A&#8221; is added to the table. Since we have 256 characters already defined for codes 0-255, the first string definition can be assigned to code 256. After the third letter, &#8216;B&#8217;, has been read in, the second string code, &#8220;AB&#8221; is added to the table, and the code for letter &#8216;A&#8217; is output. This continues until in the second word, the characters &#8216;/&#8217; and &#8216;A&#8217; are read in, matching string number 256. In this case, the code 256 is output, and a three character string is added to the string table. The process continues until the string is exhausted and all of the codes have been output.</p>
<p>&nbsp;</p>
<p>The sample output for the string is shown in Figure 1 along with the resulting string table. As can be seen, the string table fills up rapidly, since a new string is added to the table each time a code is output. In this highly redundant input, 5 code substitutions were output, along with 7 characters. If we were using 9 bit codes for output, the 19 character input string would be reduced to a 13.5 byte output string. Of course, this example was carefully chosen to demonstrate code substitution. In real world examples, compression usually doesn&#8217;t begin until a sizable table has been built, usually after at least one hundred or so bytes have been read in.</p>
<p>&nbsp;</p>
<p><strong>2.2   LZW Algorithm for Decompression</strong></p>
<p><strong>Algorithm</strong></p>
<p>&nbsp;</p>
<p>Read OLD_CODE</p>
<p>output OLD_CODE</p>
<p>WHILE there are still input characters DO</p>
<p>Read NEW_CODE</p>
<p>STRING = get translation of NEW_CODE</p>
<p>output STRING</p>
<p>CHARACTER = first character in STRING</p>
<p>add OLD_CODE + CHARACTER to the translation table</p>
<p>OLD_CODE = NEW_CODE</p>
<p>END of WHILE</p>
<p>&nbsp;</p>
<p>To read a file after compression it must be decompressed. In LZW this has a companion algorithm for decompression. It needs to be able to take the stream of codes output from the compression algorithm, and use them to exactly recreate the input stream. The decompressor builds its own dictionary on its side, that matches exactly the compressor&#8217;s, so that only the codes need to be sent.</p>
<p>&nbsp;</p>
<p>Explanation with example</p>
<p>The algorithm is shown in Figure2. Just like the compression algorithm, it adds a new string to the string table each time it reads in a new code. All it needs to do in addition to that is translate each incoming code into a string and send it to the output.</p>
<p>Figure 2 shows the output of the algorithm given the input created by the compression earlier in the article. The output string is identical to the input string from the compression algorithm. Note that the first 256 codes are already defined to translate to single character strings, just like in the compression code.</p>
<p>The decompression algorithm shown in Figure 2 is just a little too simple. There is a single exception case in the LZW compression algorithm when there is a string consisting of a (STRING,CHARACTER) pair already defined in the table, and the input stream then sees a sequence of STRING, CHARACTER, STRING, CHARACTER, STRING, the compression algorithm will output a code before the decompressor gets a chance to define it.</p>
<p>&nbsp;</p>
<p>A simple example will illustrate the point. Imagine the the string MNOPQ is defined in the table as code 280. Later on, the sequence MNOPQMNOPQMNOP occurs in the table. The compression output will look like that shown in Figure 3.</p>
<p>When the decompression algorithm sees this input stream, it first decodes the code 280 and outputs the MNOPQ string. After doing the output, it will add the definition for code 299 to the table, whatever that may be. It then reads the next input code, 300, and finds that it is not in the table. Fortunately, this is the only case where the decompression algorithm will encounter an undefined code. Since it is in fact the only case, we can add an exception handler to the algorithm. The modified algorithm just looks for the special case of an undefined code, and handles it. In the example in Figure3, the decompression routine sees a code of 300, which is undefined. Since it is undefined, it translates the value of OLD_CODE, which is code 300. It then adds the CHARACTER value, which is &#8216;M&#8217;, to the string. This results in the correct translation of code 300 to string &#8220;MNOPQMN&#8221;.</p>
<p>If we want to create a compression and decompression software it is most important to calculate the CRC32 values. It is used to check whether there is any lose of data during compression and also used to check the data lose during transmission. For that first calculate the CRC32 of the original file and store it in somewhere in memory and then compress the file and when reading the decompressed file, find the CRC32 of the decompressed file and check whether the both CRC‘s are equal. If these are same the data decompressed correctly because for all files even the words it have its own CRC32 value. It is unique value.</p>
<p><strong> </strong></p>
<p><strong>The Modified Decompression Algorithm:</strong></p>
<p>&nbsp;</p>
<p>Read OLD_CODE</p>
<p>output OLD_CODE</p>
<p>CHARACTER = OLD_CODE</p>
<p>WHILE there are still input characters DO</p>
<p>Read NEW_CODE</p>
<p>IF NEW_CODE is not in the translation table THEN</p>
<p>STRING = get translation of OLD_CODE</p>
<p>STRING = STRING + CHARACTER</p>
<p>ELSE</p>
<p>STRING = get translation of NEW_CODE</p>
<p>END of IF</p>
<p>output STRING</p>
<p>CHARACTER = first character in STRING</p>
<p>add OLD_CODE + CHARACTER to the translation table</p>
<p>OLD_CODE = NEW_CODE</p>
<p>END of WHILE</p>
<p><strong> </strong></p>
<p><strong>References:</strong></p>
<p>(1) Some parts of the text and examples taken from: Mark Nelson&#8217;s Pages. The page contains example implementation of LZW in C.</p>
<p>(2) Visit the Wikipedia page for compression: http://en.wikipedia.org/wiki/Data_compression</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hoozi.com/posts/compression-and-decompression-using-lzw-algorithm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Secure Hash Algorithm (SHA-1)  Reference implementation in C/C++ with comments</title>
		<link>http://www.hoozi.com/posts/secure-hash-algorithm-sha-1-reference-implementation-in-cc-with-comments/</link>
		<comments>http://www.hoozi.com/posts/secure-hash-algorithm-sha-1-reference-implementation-in-cc-with-comments/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 15:44:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.hoozi.com/?p=253</guid>
		<description><![CDATA[The SHA hash functions are a collection of cryptographic hash functions designed by the National Security Agency (NSA) of the US Govt. and published by the National Institute of Standards and Technology (NIST), USA. Hash algorithms compute a fixed-length digital representation (called message digest or signature or hash) of an input message of any length. [...]]]></description>
			<content:encoded><![CDATA[<p>The SHA hash functions are a collection of cryptographic hash functions designed by the National Security Agency (NSA) of the US Govt. and published by the National Institute of Standards and Technology (NIST), USA. Hash algorithms compute a fixed-length digital representation (called message digest or signature or hash) of an input message of any length. SHA-1 produces a message digest that is 160 bits long</p>
<p>A hash function is called secure when it is computationally infeasible to:</p>
<p>1) find a message that corresponds to a given hash, and</p>
<p>2) find two different messages that produce the same hash.</p>
<p>Also, any change to a message will most probably result in a different hash.</p>
<p>The implementations given here is in C / C++. It is given as an aid for beginners to get acquainted with the algorithm and can be used as a base for actual implementation. The main feature of this SHA-1 implementation is not efficiency; It is simplicity and readability.</p>
<p>&nbsp;</p>
<p>Get the source codes here:</p>
<p><a href="http://www.hoozi.com/posts/secure-hash-algorithm-sha-1-reference-implementation-in-cc-with-comments-2/">SHA-1 Secure Hash Algorithm source code in C/C++</a></p>
<p>Comments are provided as needed to understand the program. But the user must read sufficient SHA documentation to understand the underlying theory correctly. It is not possible to describe the design of the SHA algorithm in detail here. For the complete description of the algorithm, point your browser to:</p>
<p><a href="http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf">http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf</a></p>
<p>(The document also contains description of SHA-2 variants viz. SHA-224, SHA-256, SHA-384, and SHA-512)</p>
<p>&nbsp;</p>
<p>Find the Wikipedia page of SHA at:</p>
<p><a href="http://en.wikipedia.org/wiki/SHA_hash_functions">http://en.wikipedia.org/wiki/SHA_hash_functions</a></p>
<p>&nbsp;</p>
<p>SHA-1 is employed in several widely used security applications and protocols, including TLS and SSL, PGP, SSH, S/MIME, and IPsec. It was considered to be the successor to MD5, an earlier, widely-used hash function. The other variants of the algorithm collectively called SHA-2 are also in wide use now.</p>
<p>License</p>
<p>No license. This is an open source and free website. Use the resources as you like. Please link to this page and give credits if you can. And promote open source.</p>
<p>&nbsp;</p>
<p>Author: Niyaz PK</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hoozi.com/posts/secure-hash-algorithm-sha-1-reference-implementation-in-cc-with-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to set up a Neural Network for Handwriting/Character Recognition using Back-Propagation Algorithm &#8211; Text with source code</title>
		<link>http://www.hoozi.com/posts/how-to-set-up-a-neural-network-for-handwritingcharacter-recognition-using-back-propagation-algorithm-text-with-source-code/</link>
		<comments>http://www.hoozi.com/posts/how-to-set-up-a-neural-network-for-handwritingcharacter-recognition-using-back-propagation-algorithm-text-with-source-code/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 15:34:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.hoozi.com/?p=250</guid>
		<description><![CDATA[There are many algorithms and ways to accomplish the recognition of handwritten character. Although none of them can claim to provide cent percent accuracy in character recognition, many of the algorithms can provide good results. Computer engineers and mathematicians are still working to find a perfect solution for the problem. In this article, Handwritten character [...]]]></description>
			<content:encoded><![CDATA[<p>There are many algorithms and ways to accomplish the recognition of handwritten character. Although none of them can claim to provide cent percent accuracy in character recognition, many of the algorithms can provide good results. Computer engineers and mathematicians are still working to find a perfect solution for the problem.</p>
<p>In this article, Handwritten character recognition using artificial neural networks is discussed. The article is written in a manner to enable readers to write programs using artificial neural networks instantly. Even though the article emphasizes character recognition, the ideas can be applied to other problems also.</p>
<p>&nbsp;</p>
<p><strong>Introduction to Artificial Neural Networks (ANNs)</strong></p>
<p>We begin with some questions posed by beginners in the field, and the answers to those questions.</p>
<p>What is an artificial neural network?</p>
<p>An artificial neural network is a software or hardware that tries to simulate the working of the human brain. An artificial neural network is an interconnected network of many artificial neurons. These artificial neurons are objects used to simulate the neurons in the human brain.</p>
<p>&nbsp;</p>
<p>What are artificial neural networks used for?</p>
<p>Artificial neural networks are used widely in machine learning applications. They are usually used for classification problems or for problems that require some type of cognitive ability. Some examples are: Optical Character Recognition (OCR), Speech Synthesis, Data Classification etc. Neural Networks are used for many more exciting applications and it is an active research field.</p>
<p>How does a neural network work?</p>
<p>It is very important to understand how a neural network works. If we understand the basics correctly, it is easy to implement a working neural network. Here is how our character recognition neural network work:</p>
<p>&nbsp;</p>
<p>The image pattern containing a single character is given to the neural network as the input. This input is received by the input layer of the network. Each neuron in the input layer processes its inputs and produces one output each. The outputs from the neurons in the input layer becomes the inputs to the next layer in the neural network. So this process continues till the output from the output layer is obtained. This output is expected to be the character contained in the image.</p>
<p>When running a neural network for the first time, the output to an arbitrary input may not be correct. There will be errors in the output. That is, the neural network may recognize a character incorrectly. So to increase the accuracy of recognition, we must train a neural network before actual use.</p>
<p>&nbsp;</p>
<p>What is meant by &#8216;Training a neural network&#8217;?</p>
<p>A neural network before training can be thought of as the brain of a child who does not know to read alphabets. So to teach the child, we show him some alphabets and tell him what they are. We do this again and again to increase the ability of the child to read the alphabets. Likewise, an untrained neural network does not know how to recognize characters. If we give it an input, it most probably will give the wrong output. So we train the neural network with patterns which we would like it to recognize. A neural network learns from this training and becomes good in recognition.</p>
<p>&nbsp;</p>
<p>What is the algorithm used for handwriting recognition?</p>
<p>&nbsp;</p>
<p>Many beginners have the misconception that there should be some algorithm to recognize a character in an OCR program using neural networks. Actually, using a neural network saves us from having to find out an algorithm for recognition. Thus there is no need for any complicated recognition algorithm if we are using neural networks. A neural network works by itself to help us recognize the character. We just have to implement the neural network and train it properly. This is why neural networks are considered as demonstrating traits of real Artificial Intelligence (AI).</p>
<p>Note that there may be different algorithms or methods to implement a neural network. These are usually simple algorithms that are part of the neural network and they are not directly related to the problem in hand. For example, the type of neural network we use in this article is called BackPropagation Neural Network.</p>
<p>&nbsp;</p>
<p><strong>Human Neurons:</strong></p>
<p>First let us look how the human neurons work. This will help us in the study of artificial neural networks. Human neurons are biological structures that receive signals from other neurons and pass them to some other neurons.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Human Neuron</strong></p>
<p>The signals that dendrites receive are passed to the other neurons through the axon. But it is not actually a simple transfer of signals. There is some processing of signals involved before passing it to other neurons. A neuron collects the signals through the dendrites and transfers the signal only if the signals received add up to a specific threshold. Thus noise and other unwanted signals are removed.</p>
<p>&nbsp;</p>
<p><strong>Artificial Neuron:</strong></p>
<p>The artificial neuron is designed to simulate the working of a human neuron in mind. Let us discuss the details of an artificial neural network. After that we will discuss how to implement this neural networks in actual program.</p>
<p>The artificial neural network will consist of artificial neurons. Artificial neurons are thus the building blocks of any neural network. We can design a neuron in many ways. We will discuss only the type of neuron and neural network which we need for our handwriting recognition software.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>An artificial neuron will have many inputs and one output. Each input will be given different priorities. This priority is denoted by weights. Look at the figure below for more details:</p>
<p>&nbsp;</p>
<p><strong>Artificial Neuron </strong></p>
<p>In the figure, Xi denotes the ith input to the neuron. Wi denotes the weight of the ith input. In effect the value of the ith input will become: Wi * Xi</p>
<p>So, each neuron receives many inputs and gives out a single output. The output must reflect the values of the input. So we add all the inputs (Wi * Xi) and then if the total value of the inputs is more than a threshold, the output is fired. So the output will be 0 (if sum(Wi * Xi) &lt; Threshold) or 1 (if sum(Wi * Xi) &gt; Threshold) if we are using this policy. The weights are part of a neuron. They are property of a neuron and not a property of the input values. So whatever Xi arrives at an input of a neuron, the Xi is multiplied by the corresponding Wi at that input node.</p>
<p>Now according to our definition, the output of a neuron will be either 0 or 1. But this is not very good for practical implementations. WE would like to have an output that</p>
<p>&nbsp;</p>
<p>The rest of the article coming soon&#8230;Check back after some time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hoozi.com/posts/how-to-set-up-a-neural-network-for-handwritingcharacter-recognition-using-back-propagation-algorithm-text-with-source-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programming Problems: Arranging digits</title>
		<link>http://www.hoozi.com/posts/programming-problems-arranging-digits/</link>
		<comments>http://www.hoozi.com/posts/programming-problems-arranging-digits/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 15:26:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.hoozi.com/?p=246</guid>
		<description><![CDATA[Problem: Insert + or &#8211; sign anywhere between the digits 123456789 in such a way that the expression evaluates to 100. The condition is that the order of the digits must not be changed. e.g.: 1 + 2 + 3 &#8211; 4 + 5 + 6 + 78 + 9 = 100 Programming Problem: Write [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong></p>
<p>Insert + or &#8211; sign anywhere between the digits 123456789 in such a way that the expression evaluates to 100. The condition is that the order of the digits must not be changed.</p>
<p>e.g.: 1 + 2 + 3 &#8211; 4 + 5 + 6 + 78 + 9 = 100</p>
<p><strong> </strong></p>
<p><strong>Programming Problem:</strong></p>
<p>Write a program in C/C++/Java which outputs all possible solutions of the above problem.</p>
<p>Before reading the solution, please try to solve the problem on your own as it can improve your logical and analytical skills a lot. Also, readers are requested to find at least 4 solutions using paper and pencil so as to understand deeply about the problem.</p>
<p>&nbsp;</p>
<p><strong>Solution:</strong></p>
<p>Analysis of the problem:</p>
<p>The problem may seem very easy at first sight. But we will understand that it is not so. Actually solving this problem become very difficult for some one who has not seen problems pertaining to this specific class. Whenever we try to find a solution for the problem using paper and pencil, we may only find some simple solutions, and may not be able to get all the solutions.</p>
<p>Also after finding a number of solutions, we may not know whether any other solution exits or not.</p>
<p>Thus in essence, it is difficult to list all the solutions of the problem using pencil and paper. So we will use a computer to solve the problem. We have to write a program for this.</p>
<p><strong>Solution:</strong></p>
<p>Let us illustrate the basic problem statement in a more computer friendly way:</p>
<p>_1 _ 2_ 3 _4 _5 _6 _7 _8 _9</p>
<p>We must either fill the blanks above with +/- or we must remove the blanks such that the digits on either side of the blank combine to form a single number.</p>
<p>E.g.: _ 1 _ 2_ 3 _4 _5 _6 _7 _8 _9</p>
<p>becomes</p>
<p>123 &#8211; 4 + 5 + 67 &#8211; 89</p>
<p>Then we must evaluate the resulting expression to find whether it is equal to 100. If it equals 100, we may output the expression.</p>
<p>Now, there are three possible ways we may deal with a blank:</p>
<p>(1) Remove the blank</p>
<p>(2) Put a + sign in the blank</p>
<p>(3) Put a &#8211; sign in the blank</p>
<p>&nbsp;</p>
<p>We may denote these three cases using three numbers:</p>
<p>Removing blank</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="149" valign="top">Removing blank</td>
<td width="149" valign="top">0</td>
</tr>
<tr>
<td width="149" valign="top">Replace blank with +</td>
<td width="149" valign="top">1</td>
</tr>
<tr>
<td width="149" valign="top">Replace blank with -</td>
<td width="149" valign="top">2</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>We can see that there are 9 blanks altogether. So we can state the problem as filling these blanks using any of these three numbers and then executing the expression accordingly.</p>
<p>E.g.:</p>
<p>0 1 1 2 2 3 0 4 1 5 1 6 1 7 2 8 1 9</p>
<p>becomes</p>
<p>1 + 2 -34 + 5 + 6 +7 – 8 + 9</p>
<p>which calculates to -12 (hence this is not a solution of the problem)</p>
<p>So when we write a program, we must write it in such a way that it can find all the permutations of the three cases in all the blanks. Three cases means 0,1, and 2</p>
<p>number of blanks = 9</p>
<p>The program must find all permutations of 0,1 and 2 for 9 digits, and use each of these permutation to construct the expression and find if it equal to 100.</p>
<p>The easiest way to do this is consider 0,1 and 2 as the digits of a base 3 number (Eg:102,210,122210 etc&#8230;&#8230;&#8230;.) an find all base three up to a digit i.e. we have to find base 3 numbers from 000000000 to 222222222 i.e. in base 10 from 0 to 19682 (i.e. 39-1)</p>
<p>&nbsp;</p>
<p>The C source code for getting all the solutions of the problem is given below:</p>
<p>&nbsp;</p>
<p>#include&lt;stdio.h&gt;</p>
<p>#include&lt;conio.h&gt;</p>
<p>// This function is used to generate number between 0 and 2</p>
<p>int findnumber(int i,int j)</p>
<p>{</p>
<p>int k;</p>
<p>int n;</p>
<p>for(k = 0; k &lt; j; k++)</p>
<p>{</p>
<p>n = i % 3;</p>
<p>i = i / 3;</p>
<p>}</p>
<p>return n;</p>
<p>}</p>
<p>void main()</p>
<p>{</p>
<p>int i, j, k, current, result, operation;</p>
<p>clrscr();</p>
<p>for(i = 0; i &lt; 19683; i++)</p>
<p>{</p>
<p>if(i%3 == 0)</p>
<p>continue;</p>
<p>current = 0;</p>
<p>result = 0;</p>
<p>for(j = 1; j &lt; 10; j++)</p>
<p>{</p>
<p>k = findnumber(i,j);</p>
<p>if(k==0)</p>
<p>{</p>
<p>current = current * 10 + j;</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>result = result + (operation == 1 ? current : -current);</p>
<p>current = j;</p>
<p>operation = k;</p>
<p>}</p>
<p>}</p>
<p>result = result + (operation == 1 ? current : -current);</p>
<p>if(result == 100)</p>
<p>{</p>
<p>for(j = 1; j &lt; 10; j++)</p>
<p>{</p>
<p>k = findnumber(i,j);</p>
<p>if(k==0)</p>
<p>printf(&#8220;%d&#8221;,j);</p>
<p>else</p>
<p>printf(&#8220;%c%d&#8221;,k==1?&#8217;+':&#8217;-',j);</p>
<p>}</p>
<p>printf(&#8220;\n&#8221;);</p>
<p>}</p>
<p>}</p>
<p>getch();</p>
<p>}</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The source code can also be downloaded from the Downloads section</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Trace the source code to understand its working in detail.</p>
<p>&nbsp;</p>
<p>The solutions are listed below:</p>
<p>+ 123 &#8211; 45 &#8211; 67 + 89<br />
+ 12 &#8211; 3 &#8211; 4 + 5 &#8211; 6 + 7 + 89<br />
+ 12 + 3 + 4 + 5 &#8211; 6 &#8211; 7 + 89<br />
+ 123 + 4 &#8211; 5 + 67 &#8211; 89<br />
- 1 + 2 &#8211; 3 + 4 + 5 + 6 + 78 + 9<br />
+ 1 + 2 + 3 &#8211; 4 + 5 + 6 + 78 + 9<br />
+ 12 + 3 &#8211; 4 + 5 + 67 + 8 + 9<br />
+ 1 + 23 &#8211; 4 + 56 + 7 + 8 + 9<br />
+ 1 + 2 + 34 &#8211; 5 + 67 &#8211; 8 + 9<br />
+ 1 + 23 &#8211; 4 + 5 + 6 + 78 &#8211; 9<br />
+ 123 + 45 &#8211; 67 + 8 &#8211; 9<br />
+ 123 &#8211; 4 &#8211; 5 &#8211; 6 &#8211; 7 + 8 &#8211; 9</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Author: Niyaz PK</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hoozi.com/posts/programming-problems-arranging-digits/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced Encryption Standard (AES) Implementation in C/C++ with comments.</title>
		<link>http://www.hoozi.com/posts/advanced-encryption-standard-aes-implementation-in-cc-with-comments/</link>
		<comments>http://www.hoozi.com/posts/advanced-encryption-standard-aes-implementation-in-cc-with-comments/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 15:14:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.hoozi.com/?p=243</guid>
		<description><![CDATA[AES (Advanced Encryption Standard) is the latest standard for symmetric key encryption/decryption which was selected by National Institute of Standards and Technology (NIST), USA. It has been proven to be much secure than most other encryption algorithms used today. It uses key lengths of 128,192 or 256 bits. The original algorithm is called Rijndael (Rain-doll). [...]]]></description>
			<content:encoded><![CDATA[<p>AES (Advanced Encryption Standard) is the latest standard for symmetric key encryption/decryption which was selected by National Institute of Standards and Technology (NIST), USA. It has been proven to be much secure than most other encryption algorithms used today. It uses key lengths of 128,192 or 256 bits. The original algorithm is called Rijndael (Rain-doll).</p>
<p>&nbsp;</p>
<p>The implementations given here is in C / C++. It is given as an aid for beginners to get acquainted with the algorithm and can be used as a base for actual implementation. The main feature of this AES implementation is not efficiency; It is simplicity and readability.</p>
<p>&nbsp;</p>
<p>The implementation is provided in two parts. One for encryption and other for decryption. Both are stand alone programs. Please note that classes or any other OOP construct is not used in this implementation. It is advised not to use classes or high end data structures in the implementations since that can affect the performance of the algorithm seriously.</p>
<p>Get the source codes here:</p>
<p>(1) <a href="http://www.hoozi.com/posts/advanced-encryption-standard-aes-implementation-in-cc-with-comments-part-1-encryption/">AES Encryption source code in C/C++</a></p>
<p>(2) <a href="http://www.hoozi.com/posts/advanced-encryption-standard-aes-implementation-in-cc-with-comments-part-2-decryption/">AES Decryption source code in C/C+</a></p>
<p>&nbsp;</p>
<p>Comments are provided as needed to understand the program. But the user must read some AES documentation to understand the underlying theory correctly. It is not possible to describe the complete AES algorithm in detail here. For the complete description of the algorithm, point your browser to: <a href="http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf">http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf</a></p>
<p>Find the Wikipedia page of AES at:</p>
<p><a href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard">http://en.wikipedia.org/wiki/Advanced_Encryption_Standard</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hoozi.com/posts/advanced-encryption-standard-aes-implementation-in-cc-with-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Concept of DynaOS &#8211; Dynamic Operating System, An OS that can boot from remote server.</title>
		<link>http://www.hoozi.com/posts/concept-of-dynaos-dynamic-operating-system-an-os-that-can-boot-from-remote-server/</link>
		<comments>http://www.hoozi.com/posts/concept-of-dynaos-dynamic-operating-system-an-os-that-can-boot-from-remote-server/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 14:58:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.hoozi.com/?p=233</guid>
		<description><![CDATA[Abstract The bandwidths of networks are increasing overwhelmingly these days. So we need better computer systems, network architectures and software which can effectively use the available bandwidth to the maximum. This text is about an operating system that can use the high bandwidth to its maximum. DynaOS is an operating system that uses remote storage [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Abstract</strong></p>
<p>The bandwidths of networks are increasing overwhelmingly these days. So we need better computer systems, network architectures and software which can effectively use the available bandwidth to the maximum. This text is about an operating system that can use the high bandwidth to its maximum.</p>
<p>DynaOS is an operating system that uses remote storage for its working. This seminar is intended to share an overall picture of the system with as much details as possible. This seminar explains the features, design, user interface and other details of the system.</p>
<p>DynaOS has many advantages over today’s computer operating systems. The main feature of DynaOS is that it uses remote storage not only for user files, but for operating system files too. So a computer that needs to boot from DynaOS does not need any software or operating system inside it. It just haves to have a connection to the internet or any other private network that can host DynaOS. The system can then download the system files from the boot server in the network and then can access the personal files of the user stored in the server.</p>
<p><strong>CONTENTS</strong></p>
<p>No:         Topic</p>
<p>1              Introduction</p>
<p>2              DynaOS</p>
<p>2.1          History and Background</p>
<p>2.2          Present Scenario</p>
<p>2.4          What is DynaOS?</p>
<p>2.5          Implementation</p>
<p>2.6          Packages in DynaOS</p>
<p>3              General Behaviour</p>
<p>4              Setup Required</p>
<p>5              Technical Framework</p>
<p>6              Advantages</p>
<p>7              Disadvantages</p>
<p>8               Legal Issues</p>
<p>9              Conclusion</p>
<p>10           References</p>
<p>&nbsp;</p>
<p><strong>1. Introduction</strong></p>
<p>Remote storage is getting popular among internet and corporate users due to the availability of high bandwidth of computer networks. The bandwidths between computer networks are increasing and the costs are reducing. For instance, according to a news, the internet connectivity in Japan is made available to the normal people for a cost as low as Rupees 90.00 (2$) per month. This is for a broadband connection with a speed of 70Mbps using VDSL technology.</p>
<p>The speed specified above has a peculiarity. It is comparable to the speed of a current day hard disk (with 5400-7200 rpm). So this is a historical point in the history of computing. The point where network bandwidth can match the bandwidth of a local hard disk and at the same time be affordable to the common man. There are so many services already in the internet which provide remote storage for users. The storage space provided by these services is from 200 Megabytes to unlimited. Some of the services are paid services while some others are free of cost.</p>
<p>All these points mentioned above predicts a future for computing where remote storage may be the buzzword. This conclusion led to the evolution of the central idea on which this seminar is rooted. The seminar discusses a new breed of operating system called DynaOS.</p>
<p>DynaOS is an operating system that uses remote storage for its working. This seminar is intended to share an overall picture of the system with as much details as possible. This seminar explains the features, design, user interface and other details of the system.</p>
<p>&nbsp;</p>
<p><strong>2. DynaOS</strong></p>
<p><strong>2.1 History and Background</strong></p>
<p><strong>Client</strong></p>
<p>A client is a computer system that accesses a (remote) service on another computer by some kind of network. The term was first applied to devices that were not capable of running their own stand-alone programs, but could interact with remote computers via a network. These dumb terminals were clients of the time-sharing mainframe computer.</p>
<p>The client-server model is still used today on the Internet, where a user may connect to a service operating on a remote system through the internet protocol suite. Web browsers are clients that connect to web servers and retrieve web pages for display. Most people use e-mail clients to retrieve their e-mail from their internet service provider&#8217;s mail storage servers. Online chat uses a variety of clients, which vary depending on the chat protocol being used. Game Clients usually refer to the software that is the game in only multiplayer online games for the computer. Increasingly, existing large client applications are being switched to websites, making the browser a sort of universal client. This avoids the hassle of downloading a large piece of software onto any computer you want to use the application on. An example of this is the rise of webmail.</p>
<p>Clients are generally classified as &#8220;fat clients&#8221;, &#8220;thin clients&#8221;, or &#8220;hybrid clients&#8221;.</p>
<p>&nbsp;</p>
<p><strong>Local storage</strong></p>
<p>Local processing</p>
<p>Fat Client             Yes         Yes</p>
<p>Hybrid Client      No          Yes</p>
<p>Thin Client           No          No</p>
<p>&nbsp;</p>
<p><strong>Fat client</strong></p>
<p>A fat client (also known as a thick client or rich client) is a client that performs the bulk of any data processing operations itself, and does not necessarily rely on the server. The fat client is most common in the form of a personal computer, as the personal computers or laptops can operate independently. Programming environments for rich clients include Curl, Delphi, Droplets, Java, win32 and X11.</p>
<p><strong>Thin client</strong></p>
<p>A thin client is a minimal sort of client. Thin clients use the resources of the host computer. A thin client&#8217;s job is generally just to graphically display pictures provided by an application server, which performs the bulk of any required data processing. Programming environments for thin clients include JavaScript/AJAX (client side automation), ASP, JSP and PHP (server side HTML generation).</p>
<p><strong>Hybrid client</strong></p>
<p>A hybrid client is a mixture of the above two client models. Similar to a fat client, it processes locally, but relies on the server for storage data. This approach offers features from both the fat client (multimedia support, high performance) and the thin client (high manageability, flexibility).</p>
<p><strong>2.2 Present Scenario</strong></p>
<p>Now in India, the government is planning to implement Fiber-To-The-Home (FTTH) technology, which offers very high transfer rates to the end user, compared to VDSL, and has no distance limitations like VDSL. Meaning, the bandwidth limitation issue, sooner or later, is going to be an issue of the past.</p>
<p>There are many points that favor the arrival of DynaOS. Some of the main and influential points are:</p>
<p>• Bandwidth is no more a problem.</p>
<p>• Remote storage is growing popular.</p>
<p>• Web applications are getting more sophisticated.</p>
<p>• Data availability is a big problem.</p>
<p><strong>2.3 What is DynaOS?</strong></p>
<p>The term “DynaOS” is the short form of Dynamic Operating system. So DynaOS is a Dynamic Operating System.</p>
<p>It’s like a web application</p>
<p>The entire system can be compared to the working of a web application where it delivers the right content to the user depending upon the type of user and his privileges. The user can then play around in the interface given to him/her.</p>
<p>Consider Gmail as a mail client application (like Ms Outlook), but unlike Outlook it’s always there in the net ready to use. You don’t have to use the same system for accessing your personal mails. Consider a guy using Outlook to check mail from net cafes, who need to setup his connection to the mail server every time before reading his mails. Normally no one will be trying that kind of a thing to check mails on a regular basis and outlook is not targeting that kind of users. But on the other side, in Gmail you get almost all the features supported by outlook like clients, accessible from anywhere in the world, always up, running and up to date with the latest version, of course no offline reading of messages.</p>
<p>Imagine getting both the things at a place. Gmail is successful because they are using brilliant JavaScript to create that user friendly interface and features like conversation, chat, etc at a reasonable download time. It happens like the software is downloaded from the server, each time, before it is run. And this works of course because the total size of the scripts and HTML that Gmail uses to create the interface is not too large.</p>
<p>Think about downloading and running an application like Ms Outlook each time for checking mails. It was not actually possible in the past, considering the bandwidth requirements. But, what if, the bandwidth is not a problem? DynaOS is an operating system which is designed to give users full advantage of the bandwidth they have, and the bandwidth that is poised to be available to users all around the world in a short while.</p>
<p><strong>2.4 Implementation</strong></p>
<p>To implement the system, the user must posses a computer with an NIC having a provision for plugging a boot ROM in it. This boot ROM will contain the basic program for finding a boot server, supplying authentication information collected from user to the boot server, get the system files from the boot server that are either not present in the local cache or newer than the cache and transfer the control to the system file(s) downloaded.</p>
<p>The basic diagram of the network model of DynaOS is given below:</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Figure 1.1</strong></p>
<p>The server must posses an OS for itself. It must also possess system files for the client. The server must also contain highly sophisticated account management system. The main system file will then take control of the system and will download additional system files based on checking the version of the files or checking if the files in cache are corrupted or not. When the necessary system files are loaded, the user configuration files and user data files will be downloaded as needed and the system will be ready to use. So the entire process goes like this:</p>
<p><strong>Booting</strong></p>
<p>The major steps of the booting process are:</p>
<p>• Authentication</p>
<p>• Get system files</p>
<p>• Get user files</p>
<p>• Share processing power</p>
<p>The most significant difference of this model comes at the time of booting itself. The booting process is rather complicated. It can be compared to the booting process of diskless nodes or the working of a web application where it delivers the appropriate content and/or the custom user interface to the user, but still there are a lot of differences. The booting will be via the NIC (Network Interface Card) in your PC. Knowledge of the working of diskless nodes can be helpful in understanding this concept in more detail.</p>
<p>There will be boot ROM in the NIC containing some loading program that when executed broadcasts requests to network for getting an IP address and a bootable HDD. When it gets an IP and a bootable drive, it boots from there. The situation is somewhat like that here also. But little more complicated tasks are included like authentication and booting from a custom image provided by the boot server.</p>
<p><strong>Definitions of Boot Server and Boot Client</strong></p>
<p>&nbsp;</p>
<p>The boot client is the machine which is trying to boot.</p>
<p>The boot server is the machine which provides all software resources for the boot client for booting.</p>
<p>&nbsp;</p>
<p><strong>Steps in System Booting</strong></p>
<p>(1) POST (Power-On Self Test) completed.</p>
<p>(2) BIOS identifies the loader in the boot ROM and transfer control to it.</p>
<p>(3) The boot program in ROM loads and collects authentication information from user (a universal user ID and password).</p>
<p>(4) It checks if a boot server is available by making broadcast requests.</p>
<p>(5) If no boot server is found:</p>
<p>(5.1) The system tries to boot to the cache (created during last boot) in the local storage.</p>
<p>(5.2) It invokes the basic system files in cache and gives authentication information to it.</p>
<p>(5.3) If the system files loaded from cache authenticates the user (checking stored authentication info of previous users booted in that machine) the system boots from the local cache, but with a lot of limitations and threats like corrupted files. In this mode, it works like current day PC operating systems like Microsoft Windows.</p>
<p>(5.4) If the system files loaded from cache rejects authentication, the boot loader comes back to the user authentication section.</p>
<p>(6) If a boot server accepts request:</p>
<p>(6.1) It sends the authentication information to the boot server, along with information like NIC physical address and all.</p>
<p>(6.2) If the server authenticates user the boot process continues with downloading of system files and user preferences.</p>
<p>(6.3) If the server rejects authentication, the boot loader comes back to the user authentication section.</p>
<p><strong>(7) System booted.</strong></p>
<p>What does the boot server do?</p>
<p>The boot server, getting a broadcasted request from a boot client, sees if the system is safe to boot (server is not overloaded, has no corrupted files and other security and network issues), then acknowledges the request, giving the client an IP address and all if necessary.</p>
<p>Then the server authenticates the user checking the information with the directory stored either locally or a remote. If the authentication information is correct, and the server is safe to boot at the instant, the server collects the user privileges and preferences from the directory and supplies system files according to that. It can also supply data stored in its storage for user as per request. Normally the user configuration files, application settings and personal files (like address book) will be stored in remote storage servers. The user can make use of the local storage too, for huge files and all, but will not be accessible globally.</p>
<p>The server will be able to control the client at any point, with the user’s permission. For example the server can ask the client to shutdown or reboot, because it found a fatal bug in the system file it supplied. The Root boot sever can thus ask all the systems to update a particular file that is updated in the system. The user at the client can reject such orders from the boot server but this may cause the boot server to disconnect the client, leaving it to work like a stand alone machine with further boot clients under it.</p>
<p>The boot client can act as a boot server once it’s booted up. The hierarchy can be compared to a family, where, a parent is giving commands to his grown up children and the children normally obeying it. If the child decides to disobey, the parent will rethink about caring the child as before. The child will also become a parent once it’s grown up.</p>
<p><strong>2.5 Packages in DynaOS</strong></p>
<p>A package is a collection of programs, executables, libraries, related resources and sub packages. There are three types of packages:</p>
<p>1. Private</p>
<p>2. Protected</p>
<p>3. Public</p>
<p>Each type of package has its own properties and privileges. Packages are used mainly t implement security and authenticity to users and files.</p>
<p>Each type of package is described briefly below:</p>
<p><strong>Private</strong></p>
<p>All the programs and executables that are used by the server and only by the server fall in to this category. The server is not willing to share it to any machine connected to it (boot clients, other servers, siblings) or inherit it to the clients booting from it.</p>
<p><strong>Protected</strong></p>
<p>This type of programs is given to the boot clients booting from the server. Normally the DynaOS Kernel falls in to this category. There are exceptions when a DynaOS loaded machine decides not to allow booting from it but provide other service or stay as stand alone machine. Certain applications like a company’s internal information system can also fall in to this type.</p>
<p><strong>Public</strong></p>
<p>Here come items that are given to every one. Normally a DynaOS loaded machine in web server mode will provide the public documents and executables in this type. In DynaOS world, there will be no websites serving static HTML documents but every website will be providing a very interactive web application!!!</p>
<p><strong>3. General Behaviour</strong></p>
<p>DynaOS is an online operating system that makes use of remote storage. It acts as any usual operating system and provides all the functionalities of a complete operating system. The user interface and usage of DynaOS will be similar to that existing in any modern day operating system.</p>
<p>DynaOS needs high speed broadband network to operate on. It can manage any number of clients by the mechanism of giving the functionality of a boot server to a client which completed it booting procedure.</p>
<p>All the user files including settings and preferences will be stored remotely. Each user will have to pay a certain amount as fee for using DynaOS. The amount will be calculated according to the usage of DynaOS and other softwares installed in the DynaOS.</p>
<p>&nbsp;</p>
<p><strong>4. Setup Required</strong></p>
<p>For implementing DynaOS in a large scale, at least the following are required:</p>
<p>(1) A server loaded with DynaOS</p>
<p>The server must at least be having 1 Terabytes of secondary storage memory to cater to the needs of the users. It must also be able to process a large number of user requests at the same time.</p>
<p>(2) The server must be connected to a high speed network</p>
<p>(3) The network must have a bandwidth of at least 50Mbps.</p>
<p>Even if the bandwidth of the network is lesser than this specified amount, DynaOS may work, but the bandwidth specified is the minimum required for optimum performance.</p>
<p>(4) Clients that are connected to the network are also required.</p>
<p>(5) The clients and the server must be able to send or receive data in the network at least at the rate of 50Mbps.</p>
<p>(6) The clients must have a Network Interface Card (NIC) in them. There must be provision in the NIC to plug in a boot ROM into it.</p>
<p>(7) The Boot ROM containing a lightweight program to connect to the boot server, authenticate the user and download the initial system files should be plugged into the NIC.</p>
<p><strong>5. Technical Framework</strong></p>
<p>DynaOS contains a network of servers and clients. There will be a root boot server. The clients boot from this root boot server. After booting, a client can act as a boot server. So some other new client can boot from this boot server. This gives a distributed nature to DynaOS.</p>
<p>The clients may be connected to the servers using DHCP (Dynamic Host Configuration Protocol). After establishing a connection to the server, the client may use any reliable protocol (e.g.: TCP/IP) to communicate with the server.</p>
<p>&nbsp;</p>
<p><strong>6. Advantages of using DynaOS</strong></p>
<p>&nbsp;</p>
<p>• Reliable</p>
<p>&#8220;Always ready to run&#8221;</p>
<p>DynaOS can boot in any client from the root boot servers or from other boot servers. Whenever a client boots into DynaOS, after the system files are downloaded, the client becomes a boot server which can provide system files for other computers which want to boot into DynaOS.</p>
<p>• Up-to-date</p>
<p>“Push or Pull”</p>
<p>The operating system downloads the latest files from the boot server during booting and executes it. So the operating system running on a client is always up-to-date. Even after downloading the system files from the server, the client can check whether the files have been modified in the server after the last download. If the files have been modified, the client downloads the new and updated files from the server. Also, if some critical change has been made on any file in the server by the developers or any security flaw has been fixed, the server can inform this to the client and the files can be updated in the client to. Thus updating of files can take place by the pull of the client or the push of the server.</p>
<p>• Virus safe</p>
<p>“Be good… for good”</p>
<p>No user can push a virus or worm to the system since the DynaOS servers are protected by firewalls. Also the user who tries to introduce any malicious program into the system can be identified with the user ID and can be caught. Latest antivirus software can be installed in DynaOS so that viruses can be prevented and cured. The antivirus software can be updated in the system frequently and the user need not search for the latest updates of the antivirus software.</p>
<p>• Computing power sharing</p>
<p>“Stay idle…Make money”</p>
<p>Users of DynaOS can make money by renting the processing power of their computers to other users who are in need of more processing power. There will be users who have low end computers which are not able to do the processing they require. These users may benefit from this feature of DynaOS. Also, users who need to do many heavy scientific or mathematical calculations may need processing power. Some users may require processing power for image processing or video editing. Whatever may be the reason, users can get enough processing power they need from the computers that are sitting idle in the DynaOS network.</p>
<p>• No piracy</p>
<p>“Keeping pirates at bay”</p>
<p>You cannot get DynaOS in a compact disc or any other removable storage medium. So chances of piracy are rare. Also, even if a cracker is able to get a copy of DynaOS system files in some removable storage medium, he will only be having the system files from some client. So when he tries to boot from the copy he has, the system files will try to connect to the server and boot from there. So actually, even the concept of piracy is invalid in DynaOS.</p>
<p>• Cheap</p>
<p>“Don’t buy, just rent”</p>
<p>Since a large number of users will be using DynaOS, the cost will be very less per person. DynaOS does not have the concept of buying software. You just rent software for some time and you pay according to the time used and the software used. Many major softwares are having a big price tag because of the losses occurring to the developers of it due to piracy. Since there is no piracy in DynaOS, all softwares in it will be very low priced.</p>
<p>• All software is available</p>
<p>“Everything is here”</p>
<p>All major software will be available in DynaOS. DynaOS prevents piracy and that will be a very big point concerning developers of other software. Since they get very high profit by renting their software through DynaOS, they will develop the software for DynaOS platform.</p>
<p>• Universally accessible online desktop for users</p>
<p>“Always with you”</p>
<p>Each user has a unique user ID and password. Whenever he enters using his credentials, he gets his personal desktop. This is irrespective of the computer he uses or his location. So for users there is no need of carrying their files with them. They can access their data from anywhere in the world.</p>
<p>• Less storage required</p>
<p>“Link them up”</p>
<p>Since DynaOS does not create separate system files for each user, the total storage space required is very less compared to other networking mechanisms. Also for files which are used for entertainment (music, pictures and movies), the same file is not stored for each user. Only one copy is stored in the server. For all users using the file, links will be placed instead of the actual file.</p>
<p>• Low cost of ownership/maintenance</p>
<p>“Low cost system”</p>
<p>A DynaOS client can have a secondary memory (usually hard disks) with less memory and speed since no data is to be stored in the local storage. Also, since all the software is available in DynaOS, there is no need to purchase software from the market spending huge amount of money. Users only need to pay money as they use. Thus total cost of ownership is reduced. Also, since maintenance of DynaOS is done by the DynaOS team, the user need not do any maintenance work and so the maintenance costs are also reduced.</p>
<p><strong>7. Disadvantages</strong></p>
<p>DynaOS is an operating system that needs high bandwidth. Thus it may not be useful in low bandwidth scenarios. Other flaws in the system must be exposed by detailed study by experts in the field of computers and networking.</p>
<p><strong>8. Legal Issues</strong></p>
<p>Copyright laws in all the territories using DynaOS must be followed while using DynaOS. This poses a great challenge for the developers since the law in different places may be different. Sharing copyrighted files live video clips, movies and music must be strictly filtered. Also usage of copyrighted software must be monitored.</p>
<p>Another issue that may arise is the issue of privacy. Many people will be prevented from using DynaOS by the fear of privacy issues. A good comprehensive privacy policy must be maintained to solve this problem.</p>
<p><strong>9. Conclusion</strong></p>
<p>This concept can be considered as nothing more than a day dream. But if handled seriously, I believe that it has got the potential to revolutionize the world of computers and thus the world we live in. As discussed earlier, flaws in the system must be exposed and handled correctly to develop the concept of DynaOS.</p>
<p>&nbsp;</p>
<p>10. References</p>
<p>1. <a href="http://www.dynaos.blogspot.com/">http://www.dynaos.blogspot.com/</a>. This is the basic text containing the text and ideas about DynaOS. Text written by Faiz VP, a former student of RIT.</p>
<p>2. <a href="http://www.wikipedia.org/">http://www.wikipedia.org/</a>. The details about clients, thin clients, thick clients etc were taken from the Wikipedia website.</p>
<p>Author: Niyaz PK</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hoozi.com/posts/concept-of-dynaos-dynamic-operating-system-an-os-that-can-boot-from-remote-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

