<?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>rarmknecht.net</title>
	<atom:link href="http://rarmknecht.net/wp/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://rarmknecht.net/wp</link>
	<description>On Security, Programming, Ruby, and other Geeky Topics</description>
	<lastBuildDate>Tue, 03 Feb 2009 03:41:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>New Section, New Start?</title>
		<link>http://rarmknecht.net/wp/?p=62</link>
		<comments>http://rarmknecht.net/wp/?p=62#comments</comments>
		<pubDate>Tue, 03 Feb 2009 03:41:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[School]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://rarmknecht.net/wp/?p=62</guid>
		<description><![CDATA[I&#8217;ve recently created a new section above called &#8220;Academics&#8221; that I plan on using for hosting various projects/papers from my graduate studies. I posted two papers from my last two terms and will hopefully have more to post this term.
I&#8217;ve also upgraded the site to Wordpress 2.7 so I&#8217;ll have to checkout the new features [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently created a new section above called &#8220;Academics&#8221; that I plan on using for hosting various projects/papers from my graduate studies. I posted two papers from my last two terms and will hopefully have more to post this term.</p>
<p>I&#8217;ve also upgraded the site to Wordpress 2.7 so I&#8217;ll have to checkout the new features and see what&#8217;s what. So far so good.</p>
]]></content:encoded>
			<wfw:commentRss>http://rarmknecht.net/wp/?feed=rss2&amp;p=62</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xorg.conf for nVidia Geforce 9400 &#8211; Dual Screen</title>
		<link>http://rarmknecht.net/wp/?p=52</link>
		<comments>http://rarmknecht.net/wp/?p=52#comments</comments>
		<pubDate>Tue, 03 Feb 2009 03:38:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://rarmknecht.net/wp/?p=52</guid>
		<description><![CDATA[# Below is a working xorg.conf file from my system as of the date noted two lines below.
# Posted for personal reference.
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 1.0  (buildmeister@builder63)  Tue Nov  4 14:08:09 PST 2008
Section &#8220;ServerLayout&#8221;
Identifier     &#8220;DUAL&#8221;
Screen      0  &#8220;Screen0&#8243; 1280 0
Screen      1  &#8220;Screen1&#8243; LeftOf &#8220;Screen0&#8243;
InputDevice    &#8220;Keyboard0&#8243; &#8220;CoreKeyboard&#8221;
InputDevice    &#8220;Mouse0&#8243; &#8220;CorePointer&#8221;
EndSection
Section &#8220;Files&#8221;
EndSection
Section &#8220;Module&#8221;
Load           [...]]]></description>
			<content:encoded><![CDATA[<p># Below is a working xorg.conf file from my system as of the date noted two lines below.<br />
# Posted for personal reference.<br />
# nvidia-settings: X configuration file generated by nvidia-settings<br />
# nvidia-settings:  version 1.0  (buildmeister@builder63)  Tue Nov  4 14:08:09 PST 2008</p>
<p>Section &#8220;ServerLayout&#8221;</p>
<p>Identifier     &#8220;DUAL&#8221;<br />
Screen      0  &#8220;Screen0&#8243; 1280 0<br />
Screen      1  &#8220;Screen1&#8243; LeftOf &#8220;Screen0&#8243;<br />
InputDevice    &#8220;Keyboard0&#8243; &#8220;CoreKeyboard&#8221;<br />
InputDevice    &#8220;Mouse0&#8243; &#8220;CorePointer&#8221;<br />
EndSection</p>
<p>Section &#8220;Files&#8221;<br />
EndSection</p>
<p>Section &#8220;Module&#8221;<br />
Load           &#8220;dbe&#8221;<br />
Load           &#8220;extmod&#8221;<br />
Load           &#8220;type1&#8243;<br />
Load           &#8220;freetype&#8221;<br />
Load           &#8220;glx&#8221;<br />
EndSection</p>
<p>Section &#8220;ServerFlags&#8221;<br />
Option         &#8220;Xinerama&#8221; &#8220;1&#8243;<br />
EndSection</p>
<p>Section &#8220;InputDevice&#8221;</p>
<p># generated from default<br />
Identifier     &#8220;Mouse0&#8243;<br />
Driver         &#8220;mouse&#8221;<br />
Option         &#8220;Protocol&#8221; &#8220;auto&#8221;<br />
Option         &#8220;Device&#8221; &#8220;/dev/psaux&#8221;<br />
Option         &#8220;Emulate3Buttons&#8221; &#8220;no&#8221;<br />
Option         &#8220;ZAxisMapping&#8221; &#8220;4 5&#8243;<br />
EndSection</p>
<p>Section &#8220;InputDevice&#8221;</p>
<p># generated from default<br />
Identifier     &#8220;Keyboard0&#8243;<br />
Driver         &#8220;kbd&#8221;<br />
EndSection</p>
<p>Section &#8220;Monitor&#8221;<br />
Identifier     &#8220;Monitor0&#8243;<br />
VendorName     &#8220;Unknown&#8221;<br />
ModelName      &#8220;DELL 1703FP&#8221;<br />
HorizSync       30.0 &#8211; 80.0<br />
VertRefresh     56.0 &#8211; 76.0<br />
Option         &#8220;DPMS&#8221;<br />
EndSection</p>
<p>Section &#8220;Monitor&#8221;<br />
Identifier     &#8220;Monitor1&#8243;<br />
VendorName     &#8220;Unknown&#8221;<br />
ModelName      &#8220;hp L1730&#8243;<br />
HorizSync       30.0 &#8211; 83.0<br />
VertRefresh     56.0 &#8211; 76.0<br />
Option         &#8220;DPMS&#8221;<br />
EndSection</p>
<p>Section &#8220;Device&#8221;<br />
Identifier     &#8220;Device0&#8243;<br />
Driver         &#8220;nvidia&#8221;<br />
VendorName     &#8220;NVIDIA Corporation&#8221;<br />
BoardName      &#8220;GeForce 9400 GT&#8221;<br />
BusID          &#8220;PCI:2:0:0&#8243;<br />
Screen          0<br />
EndSection</p>
<p>Section &#8220;Device&#8221;<br />
Identifier     &#8220;Device1&#8243;<br />
Driver         &#8220;nvidia&#8221;<br />
VendorName     &#8220;NVIDIA Corporation&#8221;<br />
BoardName      &#8220;GeForce 9400 GT&#8221;<br />
BusID          &#8220;PCI:2:0:0&#8243;<br />
Screen          1<br />
EndSection</p>
<p>Section &#8220;Screen&#8221;<br />
Identifier     &#8220;Screen0&#8243;<br />
Device         &#8220;Device0&#8243;<br />
Monitor        &#8220;Monitor0&#8243;<br />
DefaultDepth    24<br />
Option         &#8220;TwinView&#8221; &#8220;0&#8243;<br />
Option         &#8220;metamodes&#8221; &#8220;DFP-0: nvidia-auto-select +0+0&#8243;<br />
SubSection     &#8220;Display&#8221;<br />
Depth       24<br />
EndSubSection<br />
EndSection</p>
<p>Section &#8220;Screen&#8221;<br />
Identifier     &#8220;Screen1&#8243;<br />
Device         &#8220;Device1&#8243;<br />
Monitor        &#8220;Monitor1&#8243;<br />
DefaultDepth    24<br />
Option         &#8220;TwinView&#8221; &#8220;0&#8243;<br />
Option         &#8220;metamodes&#8221; &#8220;DFP-1: nvidia-auto-select +0+0&#8243;<br />
SubSection     &#8220;Display&#8221;<br />
Depth       24<br />
EndSubSection<br />
EndSection</p>
]]></content:encoded>
			<wfw:commentRss>http://rarmknecht.net/wp/?feed=rss2&amp;p=52</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quickie: Paper Pong</title>
		<link>http://rarmknecht.net/wp/?p=51</link>
		<comments>http://rarmknecht.net/wp/?p=51#comments</comments>
		<pubDate>Wed, 28 May 2008 04:31:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[pong]]></category>
		<category><![CDATA[quickie]]></category>
		<category><![CDATA[reddit]]></category>

		<guid isPermaLink="false">http://rarmknecht.net/wp/?p=51</guid>
		<description><![CDATA[I was browsing Reddit this evening and came across Paper Pong.  It&#8217;s a paper based version of pong that is based on the idea of the Choose Your Own Adventure books I read and loved as a kid. It&#8217;s not very fun, but it did get me thinking about most simple games are nothing [...]]]></description>
			<content:encoded><![CDATA[<p>I was browsing <a href="http://reddit.com/">Reddit</a> this evening and came across <a href="http://paperconsole.com/">Paper Pong</a>.  It&#8217;s a paper based version of pong that is based on the idea of the <a href="http://www.gamebooks.org/show_series.php?id=30">Choose Your Own Adventure</a> books I read and loved as a kid. It&#8217;s not very fun, but it did get me thinking about most simple games are nothing but a series of predefined states with transitions from one to another based on the rules of the game. To make a paper version, all that&#8217;s needed is to draw out all possible states and then link them with page numbers.  The part that made me smile the most was the message on page 25. &#8220;To quit, close this book.&#8221;</p>
<p>You can play Paper Pong <a href="#" onClick="javascript:window.open('http://paperconsole.com/paperpong.html','PaperPong','width=620,height=450,resizable=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no')">here</a> in a new window (popup).</p>
]]></content:encoded>
			<wfw:commentRss>http://rarmknecht.net/wp/?feed=rss2&amp;p=51</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quickie: DTrace and Ruby</title>
		<link>http://rarmknecht.net/wp/?p=50</link>
		<comments>http://rarmknecht.net/wp/?p=50#comments</comments>
		<pubDate>Mon, 26 May 2008 01:08:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dtrace]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[project euler]]></category>
		<category><![CDATA[quickie]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://rarmknecht.net/wp/?p=50</guid>
		<description><![CDATA[There is an excellent article over on the Red Artisan blog about using DTrace with Ruby on Mac OS X. I look forward to trying this out and applying it towards Project Euler solutions. Should be interesting!
]]></description>
			<content:encoded><![CDATA[<p>There is an <a href="http://redartisan.com/2008/5/18/dtrace-ruby">excellent article </a>over on the <a href="http://redartisan.com/blog">Red Artisan blog</a> about using DTrace with Ruby on Mac OS X. I look forward to trying this out and applying it towards Project Euler solutions. Should be interesting!</p>
]]></content:encoded>
			<wfw:commentRss>http://rarmknecht.net/wp/?feed=rss2&amp;p=50</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with Binary in Ruby</title>
		<link>http://rarmknecht.net/wp/?p=48</link>
		<comments>http://rarmknecht.net/wp/?p=48#comments</comments>
		<pubDate>Thu, 22 May 2008 04:53:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://rarmknecht.net/wp/?p=48</guid>
		<description><![CDATA[This post is mainly for my own information, but hopefully someone else will find it useful as well. I was struggling a little to find solid information on how to handle binary files in Ruby.  I appreciate that a String can double as a binary data buffer, and actually depend on that quite a [...]]]></description>
			<content:encoded><![CDATA[<p>This post is mainly for my own information, but hopefully someone else will find it useful as well. I was struggling a little to find solid information on how to handle binary files in Ruby.  I appreciate that a String can double as a binary data buffer, and actually depend on that quite a bit.  In order to make something &#8220;useful&#8221; that helped me learn I created a simple version of the popular tool <strong>xxd</strong>.  The code can be found below.</p>
<p><em>* Note: This is most deffinately prototype code that needs to be refined. I&#8217;m also of the opinion that several parts within it are &#8220;ugly&#8221;</em></p>
<pre class="brush: ruby;">
#!/usr/bin/env ruby

class Hexdemo 

        def initialize  filename
                @filename = filename
        end

        def print_file

                string = File.read(@filename)

                arr = data_string_to_hex_array string
                print_hex_array arr

        end

        def data_string_to_hex_array data
                tmp = []
                data.each_byte { |byte| tmp.push byte.to_s(16) }
                (0..(tmp.length-1)).each do |idx|
                        if tmp[idx].length == 1
                                tmp[idx] = &quot;0&quot; &lt;&lt; tmp[idx]
                        end
                end
                return tmp
        end

        def print_hex_array arr
                line = 0;
                ascii = []
                print &quot;0\t&quot;
                (0..(arr.length-1)).each do |idx|
                        print &quot;][ &quot; if idx % 8 == 0 &amp;&amp; idx % 16 != 0

                        if idx % 16 != 0 || idx == 0
                                print arr[idx] &lt;&lt; &quot; &quot;
                                if arr[idx].hex &gt;= 32 &amp;&amp; arr[idx].hex &lt;= 126
                                        ascii.push arr[idx].hex.chr
                                else
                                        ascii.push '.'
                                end
                        else
                                print &quot;\t&quot; &lt;&lt; ascii.join('')
                                print &quot;\n&quot;
                                line += 16
                                ascii = []

                                print line.to_s &lt;&lt; &quot;\t&quot;
                                print arr[idx] &lt;&lt; &quot; &quot;
                                if arr[idx].hex &gt;= 32 &amp;&amp; arr[idx].hex &lt;= 126
                                        ascii.push arr[idx].hex.chr
                                else
                                        ascii.push '.'
                                end
                        end

                        if idx == arr.length-1
                                remaining = idx-line+1
                                if remaining &lt;= 8
                                        print ' '*3
                                end
                                print '   '*(16-remaining)
                                print &quot;\t&quot; &lt;&lt; ascii.join('')
                        end
                end
                puts &quot;&quot;
        end
end

if __FILE__ == $0

        h = Hexdemo.new ARGV[0] || &quot;data.bin&quot;
        h.print_file

end
</pre>
<p>Below you&#8217;ll find some lovely output from running it against Google&#8217;s logo.gif</p>
<pre class="brush: xml;">
rarmknecht@blinky:~/code/ruby$ ./hex.rb logo.gif
0       47 49 46 38 39 61 14 01 ][ 6e 00 f7 00 00 f7 f7 f7      GIF89a..n.......
16      ff fb ff e7 e7 e7 d6 d3 ][ d6 ef eb ef ce cb ce ad      ................
32      14 00 de db de 18 45 ad ][ 18 49 b5 10 34 84 10 3c      ......E..I..4..&lt;
48      94 c6 18 00 b5 b2 b5 f7 ][ f3 f7 8c 10 00 c6 be bd      ................
64      bd ba bd 18 4d c6 e7 e3 ][ e7 ef ef ef c6 c3 c6 f7      ....M...........
80      f3 ef bd be bd c6 c7 c6 ][ 08 51 08 ce cf ce 08 24      .........Q.....$
96      63 21 59 d6 d6 24 08 d6 ][ d7 d6 18 51 ce 9c 9e 9c      c!Y..$.....Q....
112     ef ba 00 de df de 00 65 ][ 00 d6 ae 00 63 96 ef 31      .......e....c..1
128     65 d6 4a 7d e7 08 3c a5 ][ b5 b6 b5 9c 9a 9c 73 a2      e.J}..&lt;.......s.
144     ef de df e7 39 71 de 6b ][ 0c 00 00 7d 08 ff cf 00      ....9q.k...}....
160     bd b6 bd ad a6 ad a5 a2 ][ a5 e7 49 31 29 51 b5 ff      ..........I1)Q..
176     75 63 bd 96 00 5a 8a ef ][ a5 a6 a5 10 45 b5 ad aa      uc...Z......E...
192     ad c6 9e 00 ad ae ad f7 ][ 69 52 e7 3c 21 fd fd fd      ........iR.&lt;!...
208     ef 59 42 63 d3 63 de 30 ][ 18 5a cb 5a b5 24 10 84      .YBc.c.0.Z.Z.$..
</pre>
]]></content:encoded>
			<wfw:commentRss>http://rarmknecht.net/wp/?feed=rss2&amp;p=48</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Euler: Problem 2</title>
		<link>http://rarmknecht.net/wp/?p=46</link>
		<comments>http://rarmknecht.net/wp/?p=46#comments</comments>
		<pubDate>Tue, 20 May 2008 02:12:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Fibonacci]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[project euler]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://rarmknecht.net/wp/?p=46</guid>
		<description><![CDATA[Problem two steps things up just a smidgen.
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, &#8230;
Find the sum of all the even-valued terms in the sequence which [...]]]></description>
			<content:encoded><![CDATA[<p>Problem two steps things up just a smidgen.</p>
<p style="padding-left: 30px;">Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:</p>
<p style="text-align: left; padding-left: 90px;">1, 2, 3, 5, 8, 13, 21, 34, 55, 89, &#8230;</p>
<p style="padding-left: 30px;">Find the sum of all the even-valued terms in the sequence which do not exceed four million.</p>
<p>The challenge of this problem is to accurately calculating the Fibonacci sequence while summing only the even-valued terms. Ruby allows us to treat arrays like stacks, so I can easily push a value onto the stack after calculating it as the next term. Using the <strong>last</strong> method on an array is a neat trick in Ruby to get the value of the last element in an array. I did not need to keep an entire array of Fibonacci values, but chose to since I wanted to print a list of all the values at the end. It was initially for debugging, and then because I was curious as to what last the Fibonacci number before 4 million was.  You&#8217;ll see again that I wrote my code for the general case for the sum of even Fibonacci values under N with a default of 4,000,000.</p>
<pre class="brush: ruby;">
#!/usr/bin/env ruby

class Problem

	# Create the object
	def initialize (n)
		@n = n.to_i
	end

	# Solve it
	def solve
		puts &quot;Solving for sum of even numbers in fib sequence under 4 million&quot;
		fib = [0,1]
		sum = 0
		while(fib.last &lt; @n)
			tmp = fib.last + fib[fib.length - 2]
			if tmp % 2 == 0 &amp;amp;&amp;amp; tmp &lt; @n
				puts &quot;Adding #{tmp} + #{sum} = #{tmp+sum}&quot;
				sum += tmp
			end
			fib.push tmp
		end
		puts fib.join(&quot;, &quot;)
		puts &quot;Sum: #{sum}&quot;
	end

end

if __FILE__ == $0

	# Initialize the program
	p = Problem.new ARGV[0] || 4000000
	p.solve

end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://rarmknecht.net/wp/?feed=rss2&amp;p=46</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Euler: Problem 1</title>
		<link>http://rarmknecht.net/wp/?p=45</link>
		<comments>http://rarmknecht.net/wp/?p=45#comments</comments>
		<pubDate>Tue, 20 May 2008 01:41:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[project euler]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://rarmknecht.net/wp/?p=45</guid>
		<description><![CDATA[The first problem of Project Euler is very straight forward.
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
This problem is basically making [...]]]></description>
			<content:encoded><![CDATA[<p>The first problem of Project Euler is very straight forward.</p>
<p style="padding-left: 30px;">If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.</p>
<p style="padding-left: 30px;">Find the sum of all the multiples of 3 or 5 below 1000.</p>
<p>This problem is basically making sure that the site user has a computer language at their disposal and a basic grasp of common operations such as looping, if/else, and the modulo operator.</p>
<p>My straight forward Ruby code is below.  Note that I write every Ruby program so that it can be run as an executable script that takes a value from the command line. This value is typically assigned to @n within my code. It&#8217;s used for problems that solve a general case. The general case of this problem is to find the sum of all the multiples of 3 or 5 below N.</p>
<pre class="brush: ruby;">
#!/usr/bin/env ruby

class Problem

# Create the object
def initialize (n = 10)
@n = n.to_i
@sum = 0
end

# Solve it
def solve
puts &quot;Find sum of all numbers under #{@n} disivible by 3 and 5&quot;

@n.times do |k|
@sum += k if k % 3 == 0 || k % 5 == 0
end

puts &quot;Solution: #{@sum} is solution for n = #{@n}&quot;
end
end

if __FILE__ == $0

# Initialize the program
p = Problem.new ARGV[0] || 10
p.solve

end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://rarmknecht.net/wp/?feed=rss2&amp;p=45</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thinking in Code vs. Thinking in Mathematics</title>
		<link>http://rarmknecht.net/wp/?p=43</link>
		<comments>http://rarmknecht.net/wp/?p=43#comments</comments>
		<pubDate>Mon, 19 May 2008 03:33:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[project euler]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://rarmknecht.net/wp/?p=43</guid>
		<description><![CDATA[Lately I&#8217;ve been hooked on the website Project Euler. Today I sat down to solve Problem #15:
Starting in the top left corner of a 2×2 grid, there are 6 routes (without backtracking) to the bottom right corner.
How many routes are there in a 20&#215;20 grid?
My initial thought with this was &#8220;recursion!&#8221; So I sat down [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been hooked on the website <a href="http://projecteuler.net">Project Euler</a>. Today I sat down to solve <a href="http://projecteuler.net/index.php?section=problems&amp;id=15">Problem #15</a>:</p>
<p style="padding-left: 30px;">Starting in the top left corner of a 2×2 grid, there are 6 routes (without backtracking) to the bottom right corner.<br />
How many routes are there in a 20&#215;20 grid?</p>
<p>My initial thought with this was &#8220;recursion!&#8221; So I sat down and thought about graphs and trees from previous CS classes, debated creating a node class with down and right attributes that would be check off after they were used, etc.  Then I realized that it could be solved with a single recursion function, given two arguments (the x and y position). My initial code in ruby is below:</p>
<pre class="brush: ruby;">
#!/usr/bin/env ruby

class Problem

# Constructor
def initialize (n = 10)
@n = n.to_i
@paths = 0
end

# Solve it
def solve
node(0,0)
puts &quot;Found #{@paths} paths&quot;
end

# Recursively check for paths
def node(x, y)
# First, are we the end node?
if x == @n &amp;amp;amp;amp;&amp;amp;amp;amp; y == @n
@paths += 1
return
end

# Lets go &quot;right&quot;
node(x+1,y) if x &lt; @n

# Lets go &quot;down&quot;
node(x,y+1) if y &lt; @n
end

end

if __FILE__ == $0

# Initialize the program
p = Problem.new ARGV[0] || 2
p.solve

end
</pre>
<p>This works quite well for small values of n. The issue is that it&#8217;s basically a brute force method, and performance of this falls off rather quickly as n increases.<br />
<code><br />
n	ms	paths<br />
============================<br />
2	5	6<br />
3	5	20<br />
4	5	70<br />
5	6	252<br />
6	8	924<br />
7	17	3432<br />
8	57	12870<br />
9	176	48620<br />
10	668	184756<br />
11	2513	705432<br />
12	9401	2704156<br />
</code><br />
This forced me to take another look at the problem. If I approach it from a mathematical viewpoint I can see that there is definitely a pattern. To get from the top left to the bottom right we must always go N moves to the right, and N moves downward. If we call the left and right positions X and the up and down positions Y, and write out our path with X&#8217;s and Y&#8217;s, we&#8217;ll get XXYY for one of the positions of the 2&#215;2 grid. Another would be XYYX. And so forth. What this is representing is the permutation of indistinguishable objects, where (x+y)!/(x!y!) gives the number of permutations.</p>
<p>My code for this is below:</p>
<pre class="brush: ruby;">
#!/usr/bin/env ruby

class Problem

# Create the object
def initialize (n = 10)
@n = n.to_i
@paths = 0
end

# Solve it
def solve
@paths = f(@n*2)/(f(@n)**2)
puts &quot;Found #{@paths} paths&quot;
end

# Factorial of n
def f(n)
n == 1 ? 1 : n*f(n-1)
end

end

if __FILE__ == $0

# Initialize the program
p = Problem.new ARGV[0] || 2
p.solve

end
</pre>
<p>This is much quicker. It actually is able to calculate the number of paths for a give NxN grid in just a couple milliseconds. It takes 5ms for N up to 115. Thats what I call improvement!</p>
<p>The lesson learned from this problem is that even though a &#8220;coding&#8221; solution is readily apparent (and works!) it may not necessarily be the best or most efficient solution to the problem. That is why a good understanding of math will never hurt <img src='http://rarmknecht.net/wp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://rarmknecht.net/wp/?feed=rss2&amp;p=43</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bomb #1</title>
		<link>http://rarmknecht.net/wp/?p=39</link>
		<comments>http://rarmknecht.net/wp/?p=39#comments</comments>
		<pubDate>Thu, 18 Oct 2007 03:34:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Assembly Language]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Reverse Engineering]]></category>
		<category><![CDATA[School]]></category>
		<category><![CDATA[assembly]]></category>

		<guid isPermaLink="false">http://rarmknecht.net/wp/?p=39</guid>
		<description><![CDATA[My current class assignment consists of reverse engineering a piece of code written by the professor.  Basically the program reads in one line from STDIN at a time and checks to see if it&#8217;s the right phrase. If it is, that bomb is defused and it continues to the next one. If the phrase [...]]]></description>
			<content:encoded><![CDATA[<p>My current class assignment consists of reverse engineering a piece of code written by the professor.  Basically the program reads in one line from STDIN at a time and checks to see if it&#8217;s the right phrase. If it is, that bomb is defused and it continues to the next one. If the phrase is incorrect that the bomb blows up and I&#8217;ll have to try again.</p>
<p>Below is my methodology for Phase 1.</p>
<p>** Note that as a student we were given access to the source code of the &#8220;shell&#8221; program that calls the other functions that actually do the compare.  So I know that the functions are called phase_1() through phase_6(). The function names could also be guessed by using <strong>objdump -t bomb.exe</strong> and looking at the function names.</p>
<p>** Also, solutions.txt contains a single line with content: <em>testing</em></p>
<p><code>$ gdb bomb<br />
(gdb) b phase_1<br />
(gdb) display /i $pc<br />
(gdb) r solutions.txt<br />
</code></p>
<p>That runs the program until the breakpoint is hit. Once it&#8217;s hit I run <strong>disas</strong> to display the assembly of the current function. I notice that there is a call to strings_not_equal and figure that the two values pushed onto %esp are likely the arguments, and based on the functions name, are likely strings.  I then use <strong>display /a $eax</strong> to take a look at the address contained in %eax. Finally, I use <strong>x /s 0&#215;405040</strong> and <strong>x /s 0&#215;404140</strong> to look at the strings located at those addresses.  One is the string I passed in, and the other is the wining string.  I change my solutions.txt file to have the new string in it and test it to validate. It works!  Bomb 1 defused!</p>
<p><img src="http://rarmknecht.net/wp/wp-content/uploads/2007/10/phase1.JPG" alt="Bomb - Phase 1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://rarmknecht.net/wp/?feed=rss2&amp;p=39</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PGP Whole Disk Encryption &#8211; Authentication Bypass</title>
		<link>http://rarmknecht.net/wp/?p=36</link>
		<comments>http://rarmknecht.net/wp/?p=36#comments</comments>
		<pubDate>Thu, 04 Oct 2007 22:15:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://rarmknecht.net/wp/?p=36</guid>
		<description><![CDATA[There has recently been some attention to a bypass feature in PGP Corporation&#8217;s Whole Disk Encryption product line.  The gist of it seems to be that it is possible for an encrypted volume to be set so that the passphrase requirement is waived (bypassing the authentication) for a single reboot.
While this comes across as [...]]]></description>
			<content:encoded><![CDATA[<p>There has <a href="http://securology.blogspot.com/2007/10/pgp-whole-disk-encryption-barely.html">recently</a> been <a href="http://securology.blogspot.com/2007/10/response-to-jon-callas-pgp-encryption.html">some attention</a> to a bypass feature in <a href="http://www.pgp.com/">PGP Corporation</a>&#8217;s <a href="http://www.pgp.com/products/wholediskencryption/index.html">Whole Disk Encryption</a> product line.  The gist of it seems to be that it is possible for an encrypted volume to be set so that the passphrase requirement is waived (bypassing the authentication) for a single reboot.</p>
<p>While this comes across as concerning at first, after reading the PGP Knowledgebase Article #750, it appears that the risk is minimal.  I feel that if I were a government organization, such as the CIA,NSA,FBI, DHS, etc, then I&#8217;d be worried about the types of advisories the anonymous author of <a href="http://securology.blogspot.com">securology </a>mentions.  However, most laptop thefts are by common criminals looking to make some money in a pawn shop or otherwise.  I doubt there will be many if any cases of a malicious trojan that not only replaces PGPs Bootguard with a malicious one to extend the number of unauthenticated bypasses ad infinitum, but also infects machines that the attacker can get physical access to. This would require being able to reverse engineer the PGP BootGuard code that so far even the fine folks over at <a href="http://www.encase.com/products/ee_modules.aspx#eds">Guidance Software haven&#8217;t been able to do</a>.</p>
<p>As part of risk management, there is a certain level of risk that has to be accepted. We can not live in a world without risks and should only worry about the ones that have a reasonable chance of occurring.</p>
<p>The posting lists 4 points that he/she would like addressed.</p>
<blockquote>
<ol>
<li>The feature was documented clearly, including a security warning covering the risks of its use/presence in such a way that administrators must see it.</li>
<li>The feature could be permanently disabled&#8211; not just ignored or left seemingly unused.</li>
<li>The intended use of the feature did not require the creation of a passphrase with cryptographic access to the Volume Master Key.</li>
<li>The intended use of the feature did not require the distribution of plain text scripts with an embedded passphrase to N clients each and every time that feature is needed.</li>
</ol>
</blockquote>
<p>The first point I absolutely agree with.  However, it&#8217;s worth mentioning that PGP documented this feature back on July 27th of 2007.  I would like to see the security warning though, as I personally had no knowledge of this feature until I went looking for it. Could PGP have backdated the document? Of course, but I&#8217;m hoping the company making my encryption solution isn&#8217;t that shady.</p>
<p><img src="http://rarmknecht.net/wp/wp-content/uploads/2007/10/pgpbypass.jpg" alt="PGP Bypass Document" /></p>
<p>The second point seems academic in nature to me. There are plenty of programs used in every company of every nation that have features which would be insecure. For instance, Microsoft Active Directory can allow user accounts to have blank passwords. Shouldn&#8217;t we be satisfied that in our environment the feature is disabled? Demanding that Microsoft remove the feature from the code base simply because it would be unfavorable if enabled is ridiculous. I feel like that&#8217;s what&#8217;s being demanding of PGP here. It might be a risk a 3 Letter Agency should worry about, but certainly not your typical business.</p>
<p>For the third point I&#8217;m interested to see what his proposed solution is that doesn&#8217;t allow cryptographic access to the Volume Master Key.  I may be misinformed but I&#8217;d think that without access to the VMK the laptop wouldn&#8217;t be able to decrypt anything and thus it would be impossible to boot.</p>
<p>I completely agree with this fourth point. I&#8217;ve always been against developers hard coding passwords into binaries, and especially into plain text script files.  PGP should allow an alternate form of authentication that doesn&#8217;t require displaying the password.  I have some thoughts on this but will likely post them later.</p>
<p>Overall though I&#8217;m very impressed with the writing style and depth of thought that the author behind Securology has shown. I plan to keep reading and keep learning.</p>
<blockquote></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://rarmknecht.net/wp/?feed=rss2&amp;p=36</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

