<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Quick *nix shadow passwords with Ruby</title>
	<atom:link href="http://www.opensourcery.co.za/2009/05/01/quick-nix-shadow-passwords-with-ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.opensourcery.co.za/2009/05/01/quick-nix-shadow-passwords-with-ruby/</link>
	<description>Wizardry through open source</description>
	<lastBuildDate>Thu, 11 Mar 2010 18:54:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Dean Strelau</title>
		<link>http://www.opensourcery.co.za/2009/05/01/quick-nix-shadow-passwords-with-ruby/comment-page-1/#comment-763</link>
		<dc:creator>Dean Strelau</dc:creator>
		<pubDate>Thu, 22 Oct 2009 22:49:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.opensourcery.co.za/?p=192#comment-763</guid>
		<description>Thanks for this and the comment explaining the way crypt works with different formats of salts. That&#039;s trick!

Here&#039;s my version: http://d.strelau.net/post/220354423/shadow-passwords-in-ruby</description>
		<content:encoded><![CDATA[<p>Thanks for this and the comment explaining the way crypt works with different formats of salts. That&#8217;s trick!</p>
<p>Here&#8217;s my version: <a href="http://d.strelau.net/post/220354423/shadow-passwords-in-ruby" rel="nofollow">http://d.strelau.net/post/220354423/shadow-passwords-in-ruby</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kenneth Kalmer</title>
		<link>http://www.opensourcery.co.za/2009/05/01/quick-nix-shadow-passwords-with-ruby/comment-page-1/#comment-322</link>
		<dc:creator>Kenneth Kalmer</dc:creator>
		<pubDate>Fri, 01 May 2009 13:40:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.opensourcery.co.za/?p=192#comment-322</guid>
		<description>@Brian yes, and no. Ruby uses the underlying linux crypt function (see man crypt). By default it uses a DES encryption scheme which does exactly what you said, but with glibc2 on the host things change. From the man page: If salt is a character string starting with the characters &quot;$id$&quot; followed by a string terminated by &quot;$&quot;: $id$salt$encrypted then  instead of using the DES machine, id identifies the encryption method used and this then determines how the rest of the password string is interpreted.

=&gt; &quot;abNANd1rDfiNc&quot;
irb(main):002:0&gt; &quot;secret&quot;.crypt(&quot;abasasa&quot;)
=&gt; &quot;abNANd1rDfiNc&quot;
irb(main):003:0&gt; &quot;secret&quot;.crypt(&quot;$1$abasasa&quot;)
=&gt; &quot;$1$abasasa$2RZY2vd6E2ZEPSDa0eLec0&quot;
irb(main):004:0&gt; &quot;secret&quot;.crypt(&quot;$1$abasa&quot;)
=&gt; &quot;$1$abasa$ikoKICgwOFdcWgmDl9Asy1&quot;

You can clearly see how the behavior of the crypt method changes in the latter calls. The Ruby rdoc&#039;s are confusing in this regard.</description>
		<content:encoded><![CDATA[<p>@Brian yes, and no. Ruby uses the underlying linux crypt function (see man crypt). By default it uses a DES encryption scheme which does exactly what you said, but with glibc2 on the host things change. From the man page: If salt is a character string starting with the characters &#8220;$id$&#8221; followed by a string terminated by &#8220;$&#8221;: $id$salt$encrypted then  instead of using the DES machine, id identifies the encryption method used and this then determines how the rest of the password string is interpreted.</p>
<p>=> &#8220;abNANd1rDfiNc&#8221;<br />
irb(main):002:0> &#8220;secret&#8221;.crypt(&#8220;abasasa&#8221;)<br />
=> &#8220;abNANd1rDfiNc&#8221;<br />
irb(main):003:0> &#8220;secret&#8221;.crypt(&#8220;$1$abasasa&#8221;)<br />
=> &#8220;$1$abasasa$2RZY2vd6E2ZEPSDa0eLec0&#8243;<br />
irb(main):004:0> &#8220;secret&#8221;.crypt(&#8220;$1$abasa&#8221;)<br />
=> &#8220;$1$abasa$ikoKICgwOFdcWgmDl9Asy1&#8243;</p>
<p>You can clearly see how the behavior of the crypt method changes in the latter calls. The Ruby rdoc&#8217;s are confusing in this regard.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Demant</title>
		<link>http://www.opensourcery.co.za/2009/05/01/quick-nix-shadow-passwords-with-ruby/comment-page-1/#comment-321</link>
		<dc:creator>Brian Demant</dc:creator>
		<pubDate>Fri, 01 May 2009 13:32:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.opensourcery.co.za/?p=192#comment-321</guid>
		<description>from the doc:
&quot;Applies a one-way cryptographic hash to str by invoking the standard library function crypt. The argument is the salt string, which should be two characters long, each character drawn from [a-zA-Z0-9./].&quot;

so only the first 2 chars will be used

&gt;&gt; &quot;secret&quot;.crypt &quot;ab&quot;
=&gt; &quot;abNANd1rDfiNc&quot;
&gt;&gt; &quot;secret&quot;.crypt &quot;abcd&quot;
=&gt; &quot;abNANd1rDfiNc&quot;
&gt;&gt; &quot;secret&quot;.crypt &quot;abcdefgh&quot;
=&gt; &quot;abNANd1rDfiNc&quot;</description>
		<content:encoded><![CDATA[<p>from the doc:<br />
&#8220;Applies a one-way cryptographic hash to str by invoking the standard library function crypt. The argument is the salt string, which should be two characters long, each character drawn from [a-zA-Z0-9./].&#8221;</p>
<p>so only the first 2 chars will be used</p>
<p>&gt;&gt; &#8220;secret&#8221;.crypt &#8220;ab&#8221;<br />
=&gt; &#8220;abNANd1rDfiNc&#8221;<br />
&gt;&gt; &#8220;secret&#8221;.crypt &#8220;abcd&#8221;<br />
=&gt; &#8220;abNANd1rDfiNc&#8221;<br />
&gt;&gt; &#8220;secret&#8221;.crypt &#8220;abcdefgh&#8221;<br />
=&gt; &#8220;abNANd1rDfiNc&#8221;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
