<?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>Intrepid Blog &#187; rainbow tables</title>
	<atom:link href="http://blog.affien.com/archives/tag/rainbow-tables/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.affien.com</link>
	<description>A few thoughts</description>
	<lastBuildDate>Mon, 23 Jan 2012 08:47:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Rainbow Tables: Coverage</title>
		<link>http://blog.affien.com/archives/2005/12/26/rainbow-tables-coverage/</link>
		<comments>http://blog.affien.com/archives/2005/12/26/rainbow-tables-coverage/#comments</comments>
		<pubDate>Mon, 26 Dec 2005 01:45:52 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[rainbow tables]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/?p=153</guid>
		<description><![CDATA[A rainbow table is generated by creating (m) chains usi [...]]]></description>
			<content:encoded><![CDATA[<p>A rainbow table is generated by creating (<em>m</em>) chains using randomly picked starting keys. The reduction functions result (or ought to result at least) in evenly distributed new keys. Their is only a probability that a certain key/cipher pair is in the table.</p>
<p>I&#8217;ll gradually explain how the coverage can be calculated.</p>
<p>Take <em>m</em> chains, each 1 long to cover a keyspace of N keys. The chance that you can find the key is:</p>
<p><img src='/wp-latexrender/pictures/7354b9936c442bb32918a5b7ebf3a59f.png' title='\displaystyle P = \frac{m}{N}' alt='\displaystyle P = \frac{m}{N}' align=absmiddle></p>
<p>When we have 1/2N chains, we&#8217;ll subsequently have a P of 1/2, a 50% coverage. Obvious.</p>
<p>When each chain would be 2 in length it gets trickier.</p>
<p><img src='/wp-latexrender/pictures/d6c8500f037e25ba3cb525776d189b8b.png' title='P = \frac{m}{N}' alt='P = \frac{m}{N}' align=absmiddle> still is the chance that we can find the key in the first column (first item of each chain of the table) of the table. The second column isn&#8217;t as straight forward. We&#8217;ve blindly assumed that each key in the first column is unique, which is true for the first column, but certainly isn&#8217;t for the second column. A few chains can merge. The second column is &#8216;random&#8217;.</p>
<p>The chance that a certain key is in a specific chain of the second column is <img src='/wp-latexrender/pictures/4761211cbda7f82fc281aa7b73439102.png' title='\frac{1}{N}' alt='\frac{1}{N}' align=absmiddle>. The chance that a certain key is in the second column is <img src='/wp-latexrender/pictures/c448332d9cfd17c7fe4c57cf2c1d320d.png' title='1 &amp;#8211; \left(1 &amp;#8211; \frac{1}{N} \right)^m' alt='1 &amp;#8211; \left(1 &amp;#8211; \frac{1}{N} \right)^m' align=absmiddle> (One minus the chance that there isn&#8217;t a certain key in a certain chain multiplied by itself the-amount-of-chains times).</p>
<p>The amount of keys covered by this column is the chance that a certain key is in the column times the amount of keys: <img src='/wp-latexrender/pictures/273be3ee2057e00113c9752fabb1f993.png' title='N \left(1 &amp;#8211; \left(1 &amp;#8211; \frac{1}{N} \right)^m \right)' alt='N \left(1 &amp;#8211; \left(1 &amp;#8211; \frac{1}{N} \right)^m \right)' align=absmiddle>.</p>
<p>The chance a certain key is in any of the two columns would be:</p>
<p><img src='/wp-latexrender/pictures/e0f64d78f6dff396d97b67feeac9e6f4.png' title='\left( \frac{m}{N} \right) \cdot N \left(1 &amp;#8211; \left(1 &amp;#8211; \frac{1}{N} \right)^m \right) \over N' alt='\left( \frac{m}{N} \right) \cdot N \left(1 &amp;#8211; \left(1 &amp;#8211; \frac{1}{N} \right)^m \right) \over N' align=absmiddle></p>
<p>The third column&#8217;s coverage can be calculated by taking the unique keys in the second column as <cite>m</cite> was taken for the amount of unique keys for the first column. With each chain <em>t</em> in length this formula applies:</p>
<p><img src='/wp-latexrender/pictures/f5c5c50f3b13961204be704c049ce62f.png' title='\displaystyle m_1=m \\ m_{n+1}=N \left( 1 &amp;#8211; \left( 1 &amp;#8211; \frac {1}{N} \right) \right) \\ P=1-\prod^m_{i=1}1-\frac{m_i}{N}' alt='\displaystyle m_1=m \\ m_{n+1}=N \left( 1 &amp;#8211; \left( 1 &amp;#8211; \frac {1}{N} \right) \right) \\ P=1-\prod^m_{i=1}1-\frac{m_i}{N}' align=absmiddle></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2005/12/26/rainbow-tables-coverage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rainbow Tables: Introduction</title>
		<link>http://blog.affien.com/archives/2005/12/26/rainbow-tables-introduction/</link>
		<comments>http://blog.affien.com/archives/2005/12/26/rainbow-tables-introduction/#comments</comments>
		<pubDate>Mon, 26 Dec 2005 00:52:20 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[rainbow tables]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/?p=152</guid>
		<description><![CDATA[A rainbow table is a data structure with which it is po [...]]]></description>
			<content:encoded><![CDATA[<p>A rainbow table is a data structure with which it is possible to retreive the key used to generate a ciphertext with a fixed plaintext. One common application is to reverse (password) hashes; which can be seen as cipher functions who take the message as the key and the ciphertext as the generated hash.</p>
<p>One important thing to note is that all keys and ciphertext pairs stored in the table have been precomputed during generation of the table. Generating a table that stores 1 miljon md5 password hashes, requires all those passwords to be hashed during precompution.</p>
<p>I&#8217;ve been doing some research about rainbow tables and I think it will be usefull to share some of my experiences.</p>
<p>But before I can dive into the matter I first got to explain how rainbow tables work. (or you can read <a href="http://lasecwww.epfl.ch/php_code/publications/search.php?ref=Oech03">the &#8216;official&#8217; paper about rainbow tables</a> by <em>Philippe Oechslin</em>).</p>
<p>Precomputing a significant amount of key/ciphertext (password/password hash) pairs is fairly easy. The issue is that <em>a significant</em> amount is fairly large, 2<sup>37</sup> for alphanumerical windows password hashes to give a real-life example. Because it isn&#8217;t practical to store 2<sup>37</sup> pairs of key/ciphertext&#8217;s (~2TB) on your computer; rainbow tables store chains of key/ciphertext&#8217;s pairs, more precisely they store only the starting and ending key of a chain.</p>
<p>Each chain starts with a key (randomly generated; in our example a password). The next item in the chain is the ciphertext which is calculated by the cipher (in our example the hash for the password). The next item is a key (password) again, which was generated from the ciphertext (hash) by a reduction function. This reduction function can be almost everything, it can be a XOR hash, it can be CRC32, as long as it changes the (larger) cipher text into a new key.</p>
<p>k<sub>1</sub> &#8212; cipher &#8211;&gt; C<sub>1</sub> &#8212; reduction function 1&#8211;&gt; k<sub>2</sub> &#8212; cipher &#8211;&gt; C<sub>2</sub> &#8212; reduction function 2 &#8211;&gt;&#8230;</p>
<p>Each chain has got a fixed length (<em>t</em>). In the table only the first and the last key are stored (<em>k<sub>1</sub></em> and <em>k<sub>t</sub><sub></sub></em>).</p>
<p>To look up a certain ciphertext, the reduction function is applied on the cipher text and all the end-keys of all chains are checked whether they match. If one of them matches you can regenerate the chain from the begin key stored allong the end key of the chain, and you&#8217;ll find the key that when applied the reduction and the cipher on will result in your ciphertext (which is the last ciphertext in the chain). When no end key matches, the cipher and reduction functions are applied to generate a new key, and all the end key&#8217;s are checked again. If one of the end key&#8217;s matches you know that your ciphertext is in the chain in the second-last position. Repeat this <em>t</em> times for each position in the chain.</p>
<p>It sounds straight forward, but there are some issues that appear:</p>
<ul>
<li><strong>Loops</strong>, there are some cases where the reduction function generates a key which when being applied the cipher function will become the first plain text. (K = R(S(K)), where R is the reduction function, and S is the cipher). This will cause a the rest of the chain to be useless.</li>
<li><strong>Merging chains/False alarms</strong>, because the ciphertext is larger than the key there will likely be a lot of chains with the same end point, this reduces the total coverage of the table and will cause a lot of additional time spent on the &#8216;false alarms&#8217; caused by the fact that you have to check each matching endpoint, even if the starting key is the wrong branch.</li>
</ul>
<p>To avoid loops; avoid merging chains a bit more and to increase lookup speed, rainbow tables use rainbow chains: each column in the table uses a different reduction function.</p>
<p>Because we use a different reduction function for each ciphertext in the chain there can&#8217;t be loops, or at least not loops that cause redundant data, because a certain ciphertext will become a different key in a different column of the chain.</p>
<p>The amount of merging chains is also cut by <em>t</em> times, because a certain key in a chain will only lead to the same chain when it is in the same place of the chain.</p>
<p>This is a very superficial explanation, read more (when you&#8217;re interested) in the <a href="http://lasecwww.epfl.ch/php_code/publications/search.php?ref=Oech03">original paper</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2005/12/26/rainbow-tables-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The problem with rainbow tables</title>
		<link>http://blog.affien.com/archives/2005/12/07/the-problem-with-rainbow-tables/</link>
		<comments>http://blog.affien.com/archives/2005/12/07/the-problem-with-rainbow-tables/#comments</comments>
		<pubDate>Wed, 07 Dec 2005 22:13:47 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[rainbow tables]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/archives/2005/12/07/the-problem-with-rainbow-tables/</guid>
		<description><![CDATA[Rainbow tables (Making a Faster Cryptanalytic Time-Memo [...]]]></description>
			<content:encoded><![CDATA[<p>Rainbow tables (<a href="http://lasecwww.epfl.ch/php_code/publications/search.php?ref=Oech03">Making a Faster Cryptanalytic Time-Memory Trade-Off</a>) work fairly well, although &#8211; because they use different regression functions in the chains &#8211; they contain a lot of redundant data.</p>
<p>The example table in the paper (lanmanager hash; 8 char. alpha; 4666&#215;38223872) contains a lot of redundant data, which can be calculated:</p>
<p><code>&gt;&gt;&gt; CalcRedundancy(4666, 38223872, CalcN(26, 1, 7))<br />
21.50866258033486</code></p>
<p>The 300mb table would be stored in a 20mb table if the regression function was to be perfect.</p>
<p>The problem is that to make a regression function perfect, it should be &#8216;in paralel&#8217; with the cipher function, which isn&#8217;t an option for most of these are engineered to prevent this.</p>
<p>Adding variable length chains back into the rainbow chains could allow exploiting existing chains more efficiently.</p>
<p>This probably sounds messy and to be honoust this idea is still a bit messy.</p>
<p>I`ll write something decent along the way.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2005/12/07/the-problem-with-rainbow-tables/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

