<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.1.2" -->
<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/"
	>

<channel>
	<title>maths and c++ 101</title>
	<link>http://mi.lubox.net</link>
	<description>Mathematics, Data Encryption, Security, C++</description>
	<pubDate>Fri, 06 Aug 2010 13:46:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1.2</generator>
	<language>en</language>
			<item>
		<title>to cool things off a bit :)</title>
		<link>http://mi.lubox.net/28</link>
		<comments>http://mi.lubox.net/28#comments</comments>
		<pubDate>Wed, 24 Sep 2008 17:00:09 +0000</pubDate>
		<dc:creator>luan</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mi.lubox.net/28</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[]]></content:encoded>
			<wfw:commentRss>http://mi.lubox.net/28/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dictionary attack on Linux passwd/shadow authentication scheme</title>
		<link>http://mi.lubox.net/25</link>
		<comments>http://mi.lubox.net/25#comments</comments>
		<pubDate>Wed, 23 Apr 2008 21:11:57 +0000</pubDate>
		<dc:creator>luan</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mi.lubox.net/25</guid>
		<description><![CDATA[1. /etc/shadow
On linux system user information are stored in /etc/passwd. This file is world-readable (readable by any user of the computer system, even nobody) So it is not a good idea to keep user passwords in it, even encrypted password.
The need to store (encrypted) password introduces the shadow file, which is /etc/shadow. It contains the [...]]]></description>
			<content:encoded><![CDATA[<p>1. /etc/shadow</p>
<p>On linux system user information are stored in <strong>/etc/passwd</strong>. This file is world-readable (readable by any user of the computer system, even <strong>nobody</strong>) So it is not a good idea to keep user passwords in it, even encrypted password.</p>
<p>The need to store (encrypted) password introduces the shadow file, which is /etc/shadow. It contains the password which has been encrypted with the salt, which is also in the shadow file.</p>
<p>contain of shadow file could be as follow:</p>
<p><u>luana</u>:$1$<u><strong>TaORQ38u</strong></u>$<u><strong>Mfaih1b244CcesjU7Sj2T1</strong></u>:13975:0:99999:7:::</p>
<p>here, luana is the username</p>
<p><strong>$1$</strong> indicates we&#8217;re using a salt (<u><strong>TaORQ38u</strong></u>) and md5sum is being used to encrypt the key, <strong>$</strong> signifies the beginning of the encrypted password (<u><strong>Mfaih1b244CcesjU7Sj2T1) </strong></u>and ends before <strong>:</strong></p>
<p>2. Salt</p>
<p>salt is a string, publicly available (if you can see encrypted passwords you can see the salt), used to help with the password encryption process. Since encryption is a on-to function (or a surjection - see http://mathworld.wolfram.com/Surjection.html) two of the same words will encrypt to the same ciphertext. This means on a system with very large amount of user there will be a chance someone will use some very bad passwords (like &#8220;password&#8221; etc) and it will shows as two identical ciphertext in the shadow file.</p>
<p>Salt is mostly unique to each user. It is often the encryption of the time the user is added to the system (thus relatively unique for each user). This salt is mixed with the user password before we start the encryption. This means for any given two users it is extremely unlikely that they are BOTH added to the system at the same time and use the same password.</p>
<p>Simply put, salts allow the system to afford users to use the same passwords without having two identical encrypted passwords in its password file.</p>
<p>3. Note about writing programs on linux that uses crypt()</p>
<p>crypt is standard to most c/c++ compilers on linux system. This means you don&#8217;t even have to do #include &lt;&gt; in your program to use these functions.</p>
<p>Example program:</p>
<blockquote><p> #include &lt;iostream&gt;<br />
int main()<br />
{<br />
std::cout&lt;&lt;crypt(&#8221;kccL;pw_d:&#8221;,&#8221;$1$TMVRB39B&#8221;);<br />
return 0;<br />
}</p></blockquote>
<p>When compiled on linux system (with GNU cryptography library installed) you would run:</p>
<p>[lubox@neo 3]$ <strong>g++ hw3.cpp -o o -lcrypt</strong></p>
<p>Notice the -lcrypt option at the end. This will tell the compiler that you are using crypt function.</p>
<p>The above program when run will yield output:</p>
<p>$1$TMVRB39B$<strong>PUaDAsZctLWtj0kteqvBe1</strong></p>
<p>with the salt the same, and the password is encrypted into the preceding bold part.</p>
<p>4. &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://mi.lubox.net/25/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Notes for comp 3053 and 2103</title>
		<link>http://mi.lubox.net/21</link>
		<comments>http://mi.lubox.net/21#comments</comments>
		<pubDate>Mon, 31 Mar 2008 23:55:08 +0000</pubDate>
		<dc:creator>luan</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mi.lubox.net/21</guid>
		<description><![CDATA[Your test will be on April the 8th, 2008. That is a week from today.
For COMP 2103 the test will cover chapter 4.5, 4.6 and all of  5 (follow the SLIDE numbering, not the book).
Tuesday April 1st: I will go over 4.5 and 4.6 (review). You will be turning in three assignments . We go [...]]]></description>
			<content:encoded><![CDATA[<p>Your test will be on April the 8th, 2008. That is a week from today.</p>
<p>For COMP 2103 the test will cover chapter <strong>4.5, 4.6 </strong>and all of  <strong>5 </strong>(follow the SLIDE numbering, not the book).</p>
<p>Tuesday April 1st: I will go over 4.5 and 4.6 (review). You will be turning in <strong>three </strong>assignments . We go to computer lab to demonstrate your program. I will grade and return Thursday so you can review for your test.</p>
<p>Thursday April 3rd: Last class before your test. We will go over <strong>Chapter 5</strong>. Make sure you have your questions ready.</p>
<p>For COMP 3053</p>
<p>Your test will cover <strong>chapter 5 </strong>and <strong>6</strong> on the 8th of April.<br />
Tuesday April 1st: You&#8217;re turning in Assignment 7<br />
There will be an in-class assignment on this day so make sure you don&#8217;t miss class. This assignment is on your slide, about breadth-first and depth-first search.</p>
<p>On Thursday we will cover <strong>chapter 6 </strong>(Gaussian elimination, horner&#8217;s rule&#8230;)</p>
<p>Dr. R&#8217;s cellphone number:</p>
<p>1-281&#8230; you didn&#8217;t actually think I was going to put his cell phone on the internet, did you?</p>
]]></content:encoded>
			<wfw:commentRss>http://mi.lubox.net/21/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hotel Infinity and 0.(9)</title>
		<link>http://mi.lubox.net/19</link>
		<comments>http://mi.lubox.net/19#comments</comments>
		<pubDate>Fri, 21 Mar 2008 23:00:50 +0000</pubDate>
		<dc:creator>luan</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mi.lubox.net/19</guid>
		<description><![CDATA[(skip to the line break for the impatience)
For Mathematic major, after you take all your Calculus and basic linear algebra you&#8217;d advance to Advanced Calculus. Advanced Calculus is quite a big leap from the &#8220;normal&#8221; mathematics you&#8217;ve been studying so far. Now you&#8217;re not learning mathematics to solve an equation, to find a value or [...]]]></description>
			<content:encoded><![CDATA[<p>(skip to the line break for the impatience)</p>
<p>For Mathematic major, after you take all your Calculus and basic linear algebra you&#8217;d advance to Advanced Calculus. Advanced Calculus is quite a big leap from the &#8220;normal&#8221; mathematics you&#8217;ve been studying so far. Now you&#8217;re not learning mathematics to solve an equation, to find a value or evaluate an expression anymore. In Advanced Calculus (senior level courses at most College and Universities in America) you will learn about series and sequences and their properties and more. You&#8217;d be exposed to thinking very very fine (small) and also accept values and concepts that is larger than the largest thing you know so far.</p>
<p>It&#8217;s a big leap in understanding and requires a mature mind capable of abstract thinking. After you master the basics of sequences, convergence&#8230; of Advanced Calculus you&#8217;d be ready for the next step that is beginning Analysis. Intro to Analysis is a course designed to bridge the gap from Undergraduate Mathematics to a Graduate level training in the field. It&#8217;s abstract, it&#8217;s hard, it&#8217;s fun, it&#8217;s not compact(!)&#8230; you either get it or you don&#8217;t sort of thing.</p>
<p>This writing is about a classical problem in analysis. It&#8217;s would be quite straightforward to some people while does not seem &#8220;logical.&#8221; Your common sense may work for you or against you in this case. Let&#8217;s see&#8230;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>There is this hotel called Hotel Infinity. It has<strong> infinitely many</strong> rooms. Each of these rooms already has a guest in it. Now a new guest arrive.</p>
<p>None of the guests at the hotel will share a room with anyone. And no one is leaving either.</p>
<p>So how do you accommodate the new comer? Or can you accomodate him at all?</p>
<p>Logically (common sense perhaps?) if every single room in the hotel is filled then we can say the hotel is full!  Meaning no more guests can be accommodated? Well but that&#8217;s the logic for a normal hotel, this is Hotel Infinity where we have infinitely many rooms remember? Having all the rooms filled and &#8220;NO VACANCY&#8221; is two very different thing here.<br />
To accept this solution you must first accept that Hotel Infinity has <strong>infinitely many</strong> rooms. This IS the key. Infinitely many rooms means it WILL NEVER RUN OUT OF ROOMS (whether the newest room found has a guest in it or not).</p>
<p>To accommodate the new guest, you would tell the guest in room1 to move to room 2. Guest in room 2 move to room 3, room 3 move to room 4 and so on. You tell guest in room <strong>n</strong> to move to room number <strong>n+1</strong> and son on. Because you have infinitely many rooms there will always be a room for everyone to move in to. By doing this you have just freed up room 1! Now just send the new guest to this room <img src='http://mi.lubox.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Yes you just check a guest into a hotel where all the rooms are filled! Let your imagination roams <img src='http://mi.lubox.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The problem is extended when Continue&#8217;Em Tours send there entire fleet of buses to your hotel. Their fleet has infinitely many buses each carrying infinitely many guests&#8230; You own Hotel Infinity, you can accommodate a lot (understatement) of people. But how do you accommodate Continu&#8217;Em Tours guests?</p>
]]></content:encoded>
			<wfw:commentRss>http://mi.lubox.net/19/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Multiplication</title>
		<link>http://mi.lubox.net/18</link>
		<comments>http://mi.lubox.net/18#comments</comments>
		<pubDate>Fri, 21 Mar 2008 22:11:50 +0000</pubDate>
		<dc:creator>luan</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mi.lubox.net/18</guid>
		<description><![CDATA[Consider:
.              3128
.          x
.              2123
.       &#8212;&#8212;&#8212;&#8212;
(1)           9384
(2)         6256
(3)       3128
(4)     6256
.      &#8212;&#8212;&#8212;&#8212;-
.        6640744
This is 5th grade arithmetic. We all know how this multiplication works. Let&#8217;s look at the first row (1).
3 times 8 = 24 we write 4 and &#8220;save&#8221; 2.
3 times 2 = 6 we dump the 2 saved from the previous round so we write [...]]]></description>
			<content:encoded><![CDATA[<p>Consider:<br />
.              3128<br />
.          x<br />
.              2123<br />
.       &#8212;&#8212;&#8212;&#8212;<br />
(1)           9384<br />
(2)         6256<br />
(3)       3128<br />
(4)     6256<br />
.      &#8212;&#8212;&#8212;&#8212;-<br />
.        6640744</p>
<p>This is 5th grade arithmetic. We all know how this multiplication works. Let&#8217;s look at the first row (1).<br />
3 times 8 = 24 we write <strong>4</strong> and &#8220;<em>save</em>&#8221; 2.<br />
3 times 2 = 6 we dump the 2 saved from the previous round so we write <strong>8</strong>.</p>
<p>and so on.</p>
<p>But, why did we save 2 from 24?? When we first learn this multiplication at 5th grade I don&#8217;t think any of us ask this question. The reason is being you are working with decimals (base of 10). Meaning the digit 1 space to the left of the least significant bit (LSB) means how many 10s the value has. The digit 2 spaces to the left of the LSB means how many hundreds you have, and so on.</p>
<p>so for 1291 :</p>
<p>you have 1000 + 200 + 90 + 1</p>
<p>or simply, as agreed upon in base of 10, to be written as <strong>1291</strong>.</p>
<p>Now, this is definitely not the only way to represent number! For some odd reason you would like to write 1291 in say.. base 5!</p>
<p>The answer is 20131<br />
To verify you can see:</p>
<p><strong>     2</strong>*5^4  + <strong>0</strong>*5^3 + <strong>1</strong>*5^2 + <strong>3</strong>*5  + 1*5^0<br />
=  <strong>2</strong>*625 + <strong>0</strong>*125 + <strong>1</strong>*25 + <strong>3</strong>*5 + <strong>1<br />
</strong>=  <strong>1291</strong></p>
<p>Please take my word for it that this representation of 1291 decimal in base 5 is unique (it is). Now our question would be if the multiplication method we learned from 5th grade still work on number of a base other than 10? Let&#8217;s consider a small example of multiplying 29 x 67 (decimals).</p>
<p>29 (base 10) = 104 (base 5)<br />
67 (base 10) = 232 (base 5)<br />
.                         104<br />
.                      x<br />
.                         232<br />
.           &#8212;&#8212;&#8212;&#8212;</p>
<p>Remember back in decimal everytime we have something larger than 10 (or the base) we do a carry out (or &#8220;save&#8221; or &#8220;remember&#8221;)? It is the same thing here. But instead of 10, everytime you have something larger than 5 you have to carry out 1 for each &#8220;5&#8243; you have over.</p>
<p>so for 2 x 102:</p>
<p>2&#215;4 = 8 write 3 carry 1<br />
2&#215;0 = 0 write 0 + 1 = 1<br />
2&#215;1 = 2 write 2</p>
<p>so for the first round we have</p>
<p>.           104<br />
.          x<br />
.           232<br />
&#8212;&#8212;&#8212;&#8212;-<br />
.           213</p>
<p>Similarly for the other 2 operations we end up with this multiplication:</p>
<p>.           104<br />
.          x<br />
.           232<br />
&#8212;&#8212;&#8212;&#8212;-<br />
.           213<br />
.         322<br />
.        213<br />
&#8212;&#8212;&#8212;&#8212;-<br />
.        30233</p>
<p>For the final step of adding the 3 values together. When you add 2+2+3 this is 7 you write 2 (instead of 7) and carry 1 over to the next addition of 3+1. This becomes 3+1+1 = 5 so  you write 0 and carry 1 over to the final addition of 2+0. For this last one 2+1 (carry out) = 3 you write 3.</p>
<p>This final value <strong>30233 </strong>of base 5 corresponds to 1943 decimal. Which is indeed the product of 29 x 67 in base 10. :))</p>
<p>So there multiplication works with numbers of other bases also!</p>
]]></content:encoded>
			<wfw:commentRss>http://mi.lubox.net/18/feed/</wfw:commentRss>
		</item>
		<item>
		<title>vector to store arbitrary large integers</title>
		<link>http://mi.lubox.net/17</link>
		<comments>http://mi.lubox.net/17#comments</comments>
		<pubDate>Wed, 19 Mar 2008 22:41:58 +0000</pubDate>
		<dc:creator>luan</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mi.lubox.net/17</guid>
		<description><![CDATA[// bint.cpp : Defines the entry point for the console application.
//
#include &#8220;stdafx.h&#8221;
#include &#60;vector&#62;
#include &#60;string&#62;
#include &#60;iostream&#62;
typedef std::vector&#60;int&#62;::size_type v_sz;
typedef std::vector&#60;int&#62;::iterator v_it;
std::vector&#60;int&#62;&#38; init(std::string, std::vector&#60;int&#62;&#38;);
void disp(std::vector&#60;int&#62;);
std::vector&#60;int&#62;&#38; add(std::vector&#60;int&#62;&#38; result, std::vector&#60;int&#62; first, std::vector&#60;int&#62; second);
struct bint
{
std::vector&#60;int&#62; v;
};
int _tmain(int argc, _TCHAR* argv[])
{
std::string my_string = &#8220;123721846239864913265023423414379271021143241878456849752984751203980982342354362945298754350986797698729874979274932796570698709809820983393811128749879179827548719879468709398347039284153495123102987394875989347581093803948335698273416710723469187623127630875629528641908475863465981761012037164873262576128767816543&#8243;;
std::string p1 = &#8220;34288&#8243;;
std::string p2 = &#8220;14129&#8243;;
std::vector&#60;int&#62; m;
std::vector&#60;int&#62; a,b;
init(p1, a);
init(p2, b);
init(my_string, m);
disp(a);
disp(b);
disp(m);
std::cin.get();
return 0;
}
std::vector&#60;int&#62;&#38; init(std::string the_input, std::vector&#60;int&#62;&#38; v_out)
{
for (int i [...]]]></description>
			<content:encoded><![CDATA[<p>// bint.cpp : Defines the entry point for the console application.<br />
//</p>
<p>#include &#8220;stdafx.h&#8221;<br />
#include &lt;vector&gt;<br />
#include &lt;string&gt;<br />
#include &lt;iostream&gt;</p>
<p>typedef std::vector&lt;int&gt;::size_type v_sz;<br />
typedef std::vector&lt;int&gt;::iterator v_it;</p>
<p>std::vector&lt;int&gt;&amp; init(std::string, std::vector&lt;int&gt;&amp;);<br />
void disp(std::vector&lt;int&gt;);<br />
std::vector&lt;int&gt;&amp; add(std::vector&lt;int&gt;&amp; result, std::vector&lt;int&gt; first, std::vector&lt;int&gt; second);<br />
struct bint<br />
{<br />
std::vector&lt;int&gt; v;<br />
};</p>
<p>int _tmain(int argc, _TCHAR* argv[])<br />
{</p>
<p>std::string my_string = &#8220;123721846239864913265023423414379271021143241878456849752984751203980982342354362945298754350986797698729874979274932796570698709809820983393811128749879179827548719879468709398347039284153495123102987394875989347581093803948335698273416710723469187623127630875629528641908475863465981761012037164873262576128767816543&#8243;;<br />
std::string p1 = &#8220;34288&#8243;;<br />
std::string p2 = &#8220;14129&#8243;;<br />
std::vector&lt;int&gt; m;<br />
std::vector&lt;int&gt; a,b;</p>
<p>init(p1, a);<br />
init(p2, b);<br />
init(my_string, m);</p>
<p>disp(a);<br />
disp(b);<br />
disp(m);</p>
<p>std::cin.get();<br />
return 0;<br />
}</p>
<p>std::vector&lt;int&gt;&amp; init(std::string the_input, std::vector&lt;int&gt;&amp; v_out)<br />
{<br />
for (int i = the_input.size()-1; i &gt; -1; i&#8211;)<br />
{<br />
int tmp = the_input[i] - 48;<br />
v_out.push_back(tmp);<br />
}<br />
return v_out;</p>
<p>}</p>
<p>void disp (std::vector&lt;int&gt; v)<br />
{<br />
for (v_sz i = v.size()-1; i &lt; -1; i&#8211;)<br />
std::cout&lt;&lt;v[i];<br />
std::cout&lt;&lt;std::endl;<br />
}</p>
<p>std::vector&lt;int&gt;&amp; add(std::vector&lt;int&gt;&amp; result, std::vector&lt;int&gt; x, std::vector&lt;int&gt; y)<br />
{<br />
int const BASE = 10; //working with decimals</p>
<p>return result;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://mi.lubox.net/17/feed/</wfw:commentRss>
		</item>
		<item>
		<title>network for massive multiplayer online games</title>
		<link>http://mi.lubox.net/14</link>
		<comments>http://mi.lubox.net/14#comments</comments>
		<pubDate>Sat, 15 Mar 2008 21:43:30 +0000</pubDate>
		<dc:creator>luan</dc:creator>
		
		<category><![CDATA[network &amp; security]]></category>

		<guid isPermaLink="false">http://lubox.net/mi/14</guid>
		<description><![CDATA[A common trouble from massive multiplayer online role playing game (MMORPG) is the &#8220;lag&#8221; that seems to always happen whenever there is a large concentration of player in the same area. Users complain endlessly about this issues, citing &#8220;there&#8217;s no reason the service could be this bad, &#8221; or ranting that their game provider, who [...]]]></description>
			<content:encoded><![CDATA[<p>A common trouble from massive multiplayer online role playing game (MMORPG) is the &#8220;lag&#8221; that seems to always happen whenever there is a large concentration of player in the same area. Users complain endlessly about this issues, citing &#8220;there&#8217;s no reason the service could be this bad, &#8221; or ranting that their game provider, who is &#8220;racking in several tens of millions of dollars per month, yet could not improve their service even after 2 years.&#8221;</p>
<p>The most common rant is probably &#8220;upgrade the server!!&#8221; But in many cases the server (cluster) is not the issue, it is the network that is being exhausted. Let&#8217;s examine the case a bit closely.</p>
<p>Consider an MMORPG environment where there is only 1 &#8220;zone&#8221; and all the players are always in the same area and requires attention from the server and network resources. In a real MMORPG this is not likely the case but the scope of this writing is focused in situations where large amount of users present in the same area. We will see how the resource have to scale to accommodate larger number of players than normal.</p>
<p>We&#8217;re discounting the overhead of data processing to look at the network performance and scaling issues only.</p>
<p>Suppose each player needs to update 1KB (one kilo byte) of information with the server every 2s. This is only about <strong>512 bytes / second</strong> for each user<strong>, </strong>a very conservative assumption. With home residential cable connection at 3.2MBit, you are downloading at 400KB/s or about <strong>400,000 bytes a second</strong>, for comparison.</p>
<p>Consider an area where there are 100 players all with the need to update his status with the server and require the server to update him with the status of the 99 other players around him.</p>
<p>Each player are sending in 0.5 KB/s to the server. In total there are 50KB/s input to server.<br />
For each of these 2KB data packages (not packet) received the server has to process and update the other 99 player with what it receives. This implies the server is sending out almost 100*99*0.5 = 4,950KB/s or <em>39.6MBit</em> . This is very manageable for even an OC-3 line.</p>
<p>Now look at 500 players. This number is easily achieve when there is an in-game &#8220;event&#8221; of some sort. With just 5 times the users than the previous case we&#8217;re looking at the server serving 500*499*0.5 = 124,750 KB per second (998Mbit/s). Compare to the case of 100 users this 5 times increase in users has resulted in a 25 times increase in bandwidth required. Thus the <strong>amount of bandwidth required scales with the <u>square </u>of number of users</strong>.</p>
<p>As you can see with 500 players, who only need to update around 500 bytes of data to the server every second, the server already exceed the capability of an OC-12 line. This is also for just ONE realm with the spike concentration of users. I highly doubt any game company reserves a full duplex OC-12 line for each<strong> </strong>of its realm server (or server cluster for one realm).</p>
<p>So make sure they can always handle 500 users in one place at a time they&#8217;d need a faster connection! But upgrading an OC-12 line to OC-24 or OC-48 is really nothing like upgrading your home cable service from bare minimum to a Deluxe fully loaded package. It is really huge money we&#8217;re talking here.</p>
<p>Say they&#8217;re upgrading the connection to supports 500 player at a time. And what good will this do? Due to the increased connectivity of the server the number of players on the realm is also increased (to bear the cost of the new connection). This has resulted in another &#8220;big event&#8221; with 1000 users! which means it&#8217;d need almost 4Gbit of bandwidth&#8230; and so on.</p>
<p>The game company has to balance the expenses and maximize profit. They sample the data in their virtual world to see normally how many players would be in the same area at the same time and try to accommodate that. They are usually &#8220;nice&#8221; and anticipate some overhead. But it would not make good business sense to have a network ready to serve 500 player at tremendous cost while &#8220;on average&#8221; there are rarely more than 100 concentrated at any location in the &#8220;world.&#8221;</p>
<p>So next time you&#8217;re going to complain &#8220;server sucks&#8221; trust me it&#8217;s not going to change, not for your 15US a month.</p>
]]></content:encoded>
			<wfw:commentRss>http://mi.lubox.net/14/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Encryption Basics</title>
		<link>http://mi.lubox.net/6</link>
		<comments>http://mi.lubox.net/6#comments</comments>
		<pubDate>Wed, 12 Mar 2008 01:59:41 +0000</pubDate>
		<dc:creator>luan</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://lubox.net/mi/6</guid>
		<description><![CDATA[The other day I was talking to a friend of mine who is an art major. One way or another the topic of encryption came up. How I managed that is another story. This article, as I hope, will serve as an introduction to non-majors who has absolutely no exposure to this kind of materials.
Motivations
When [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I was talking to a friend of mine who is an art major. One way or another the topic of encryption came up. How I managed that is another story. This article, as I hope, will serve as an introduction to non-majors who has absolutely no exposure to this kind of materials.</p>
<p><strong>Motivations</strong></p>
<p>When datas are transmitted, most commonly over the internet or any large networks, it likely that the information will be seen by unintended parties. This is not a desirable effect but at the same time unavoidable without tremendous cost. To answer the need for confidentiality of data transmitting over networks we &#8220;encrypt&#8221; the data before transmitting.</p>
<p><strong>Again..</strong></p>
<p>Imagine networks as the roads. Any entity can stand on the side of public roads and observe the traffic on it, see what being transmitted, count how many cars (packets) of each type, when the road is busiest such and such..  Now our main characters here are Alice and Bob, they have the need to communicate constantly and privately. To avoid  people seeing her messages when using the public road Alice can build a road from her place directly to Bob. This way any items sent from her to bob will be carried on this private road that no one else has access too. This would be much more secure and preferrable than using the public road, if not for the extra cost. Even worse when Alice now want to send messages to Cooper also. We can see building private roads for each entity you would like to communicate with is not a valid solution.</p>
<p>Reason Alice didn&#8217;t want to use the public roads is because people can read her message. Now if she can somehow send something totally unintelligible to Bob, then she wouldn&#8217;t mind people reading it. However at the receiving end, bob, through some procedures, must be able to turn the encrypted message back into something meaningful. If they can do this then she can use the public road as much as she wants since she is not afraid of people seeing what she is sending (because they wouldn&#8217;t understand). That is the very basic of encryption</p>
<p><strong>The Shift Cipher:</strong></p>
<p>I&#8217;ll introduce to you the Caesar Cipher, or Shift cipher. It works as follow. Each letter in the plain text will be replaced with another letter a few places away from it in the alphabet.</p>
<p>For example:</p>
<blockquote><p>A -&gt; C<br />
B -&gt; D<br />
C -&gt; E<br />
D -&gt; F<br />
E -&gt; G<br />
F -&gt; H<br />
G -&gt; I<br />
H -&gt; J<br />
&#8230;</p>
<p>X -&gt; Z<br />
Y -&gt; A<br />
Z -&gt; B</p></blockquote>
<p>and so on.</p>
<p>Thus to send</p>
<blockquote><p>HELLO THERE</p></blockquote>
<p>you would send:</p>
<blockquote><p>JGNNQ VJGTG</p></blockquote>
<p>Here every letter is changed to the letter 2 places after it in the alphabet. For this cipher if you know the key k=2 you can encrypt message AND also decrypt (just move letters back 2 spaces). It is obvious that such a method is very insecure because there are only 26 possible keys. With little computational power one can easily attempt to decrypt with all 26 keys and will find one that is the correct key (this is the bruteforce attack).</p>
<p>But if no one know the key, then the ciphertext (the text created after the encryption process) would look totally unintelligible to a 3rd party and the communication is confidential.</p>
<p>And that is the very basic of data encryption.</p>
<p><strong>Modulo 26 </strong></p>
<p>When encrypt and decrypt messages it is natural that we assign numbers to letters in the alphabet. &#8216;A&#8217; would be 0 (zero), &#8216;B&#8217; is 1, &#8216;C&#8217; is 2, &#8230; , and &#8216;Z&#8217; is 25. Now when shifting with key = 2. &#8216;Z&#8217; will be shifted by 2 so it would be 25+2 = <strong>27</strong>. But this wouldn&#8217;t make sense since we only have 26 letters (would need 28 characters to address the value 27). It is natural to apply modulo 26 to &#8216;Z&#8217; =25 to give 1, or &#8216;B&#8217;.</p>
<p>we write</p>
<blockquote><p>27 = 1 (mod 26)</p></blockquote>
<p>26 here is called the modulo. &#8220;27 mod 26&#8243; simply is the remainder you have after you divide the modulo into 27.</p>
<p>As you could imagine</p>
<blockquote><p>27 = 2 (mod 25)</p></blockquote>
<p>Brute-force (slowest) to find <strong>x mod n </strong>is to repeatedly subtract n from x until you get to a value that is smaller than n. Of course if x &lt; n then <strong>x mod n </strong>is just x. Also <strong>n mod n </strong>= 0 for all valid n.</p>
<p>In C++ you can use the <strong>%</strong> operator to find remainder, however it does not always return a positive result. This is a simple implementation of the modulo function:</p>
<blockquote><p>int mod(int x, int n)<br />
{<br />
if (0==n) return -1;<br />
if (x&lt;0) return (x+(-1)*(x/n)*n+n);<br />
if (x&lt;n) return x;<br />
else<br />
return x-(x/n)*n;<br />
}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://mi.lubox.net/6/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Network Infrastructure for Massively Distributed Games</title>
		<link>http://mi.lubox.net/9</link>
		<comments>http://mi.lubox.net/9#comments</comments>
		<pubDate>Sat, 08 Mar 2008 20:32:24 +0000</pubDate>
		<dc:creator>luan</dc:creator>
		
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://lubox.net/mi/9</guid>
		<description><![CDATA[Reading these:
Network Infrastructure for Massively Distributed Games (free kill, to grease it up)
Provably Secure Timed-Release Public Key Encryption (intermediate)
and  ADVANCED ENCRYPTION STANDARD (AES)  (more of a battle than leisure reading)
Full text attached for the interested parties.
..will report later.
Right now feeling like:

Attachments:
Provably Secure Timed-Release Public Key Encryption
Advanced Encryption Standard (AES)
 Network Infrastructure for Massively [...]]]></description>
			<content:encoded><![CDATA[<p>Reading these:</p>
<p>Network Infrastructure for Massively Distributed Games (free kill, to grease it up)</p>
<p>Provably Secure Timed-Release Public Key Encryption (intermediate)</p>
<p>and  ADVANCED ENCRYPTION STANDARD (AES) <img src='http://mi.lubox.net/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> (more of a battle than leisure reading)</p>
<p>Full text attached for the interested parties.</p>
<p>..will report later.</p>
<p>Right now feeling like:</p>
<p><a href="http://www.phdcomics.com/comics.php?f=981"><img src="http://www.phdcomics.com/comics/archive/phd022208s.gif" title="reading journals" alt="reading journals" /></a></p>
<p>Attachments:</p>
<p><a href="http://lubox.net/mi/wp-content/uploads/2008/03/a4-cheon.pdf" title="Provable Secure Time-Release PKE">Provably Secure Timed-Release Public Key Encryption</a></p>
<p><a href="http://lubox.net/mi/wp-content/uploads/2008/03/fips-197.pdf" title="Advanced Encryption Standard (AES)">Advanced Encryption Standard (AES)</a></p>
<p><a href="http://lubox.net/mi/wp-content/uploads/2008/03/p36-bauer.pdf" title="Provable Secure Time-Release PKE"> Network Infrastructure for Massively Distributed Games</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mi.lubox.net/9/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Fun with source coding</title>
		<link>http://mi.lubox.net/7</link>
		<comments>http://mi.lubox.net/7#comments</comments>
		<pubDate>Thu, 06 Mar 2008 23:10:36 +0000</pubDate>
		<dc:creator>luan</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://lubox.net/mi/?p=7</guid>
		<description><![CDATA[Source coding
There is a story about a student of information theory on his first day at college. He had entered a strange, bizarre world. The only sounds were the occasional calling out of a number by one of the professors, followed by laughter. One professor would say &#8216;52&#8242;, there would be a short pause then [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Source coding</strong></p>
<p>There is a story about a student of information theory on his first day at college. He had entered a strange, bizarre world. The only sounds were the occasional calling out of a number by one of the professors, followed by laughter. One professor would say &#8216;52&#8242;, there would be a short pause then peals of laughter. Someone else says &#8216;713&#8242;, same thing, everyone falls down laughing.</p>
<p>&#8220;What&#8217;s going on here?&#8221; he asked his tutor.</p>
<p>&#8220;We&#8217;re telling jokes,&#8221; said his tutor.</p>
<p>&#8220;Telling jokes?&#8221;</p>
<p>&#8220;Yes, you see, we&#8217;ve all worked here so long we know each other&#8217;s jokes. There are a thousand of them. So, being information theorists we applied data compression. We just assigned them all numbers, 0 through 999. It saves a lot of time and effort. Would you like to try? Just say any number 0 to 999&#8230;&#8221;</p>
<p>He wasn&#8217;t fully convinced. But he tried. Very quietly he whispered &#8220;477&#8243;.</p>
<p>Hardly a murmur.</p>
<p>He looked at his tutor. &#8220;What&#8217;s wrong?&#8221; he said. &#8220;Try again,&#8221; says the tutor.</p>
<p>So he does. &#8220;318&#8243; - same again, not a thing, hardly a murmur.</p>
<p>&#8220;Something&#8217;s wrong,&#8221; he says.</p>
<p>&#8220;Well,&#8221; says the tutor, &#8220;it&#8217;s like this - it&#8217;s not so much the joke as the way you tell it!&#8221;</p>
<p>(to be continued)</p>
<blockquote><p>(This is an excerpt from a talk at a 1984 Seminar on Code Theory and Encryption in Zurich by John Gordon. Full text available at: <a href="http://lubox.net/mi/?page_id=8" title="Alice and Bob">http://lubox.net/mi/?page_id=8</a> - Further Credit pending)</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://mi.lubox.net/7/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
