<?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: Ruby on Rails Password Hashing Module</title>
	<atom:link href="http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing/feed" rel="self" type="application/rss+xml" />
	<link>http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing</link>
	<description></description>
	<lastBuildDate>Fri, 09 Jul 2010 16:22:10 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Guy</title>
		<link>http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing/comment-page-1#comment-10642</link>
		<dc:creator>Guy</dc:creator>
		<pubDate>Fri, 11 Sep 2009 15:44:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing#comment-10642</guid>
		<description>Diego wrote: &quot;I got an error when I use variable salt as “salt = ..”, How can I solve it?&quot;

I just replaced that line with:  
salt = &quot;&quot;</description>
		<content:encoded><![CDATA[<p>Diego wrote: &#8220;I got an error when I use variable salt as “salt = ..”, How can I solve it?&#8221;</p>
<p>I just replaced that line with:<br />
salt = &#8220;&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajat</title>
		<link>http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing/comment-page-1#comment-9330</link>
		<dc:creator>Rajat</dc:creator>
		<pubDate>Sat, 18 Jul 2009 22:41:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing#comment-9330</guid>
		<description>seems like wordpress stripped out some stuff:

	validates_length_of :password, :is =&gt; 192 #this is how long the salted hashed pws should be</description>
		<content:encoded><![CDATA[<p>seems like wordpress stripped out some stuff:</p>
<p>	validates_length_of :password, :is =&gt; 192 #this is how long the salted hashed pws should be</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajat</title>
		<link>http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing/comment-page-1#comment-9329</link>
		<dc:creator>Rajat</dc:creator>
		<pubDate>Sat, 18 Jul 2009 22:40:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing#comment-9329</guid>
		<description>Thanks Zachary, very useful. 

In my Model, i added a validation to make sure PWs are being salted properly:
Class User  192 #this is how long the salted hashed pws should be
end

its a handy error check. thanks again</description>
		<content:encoded><![CDATA[<p>Thanks Zachary, very useful. </p>
<p>In my Model, i added a validation to make sure PWs are being salted properly:<br />
Class User  192 #this is how long the salted hashed pws should be<br />
end</p>
<p>its a handy error check. thanks again</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Diego Soares</title>
		<link>http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing/comment-page-1#comment-7542</link>
		<dc:creator>Diego Soares</dc:creator>
		<pubDate>Wed, 22 Apr 2009 13:28:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing#comment-7542</guid>
		<description>I got an error when I use variable salt as &quot;salt = ..&quot;, How can I solve it?

Thanks,

Diego</description>
		<content:encoded><![CDATA[<p>I got an error when I use variable salt as &#8220;salt = ..&#8221;, How can I solve it?</p>
<p>Thanks,</p>
<p>Diego</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: links for 2009-03-14 &#171; Amy G. Dala</title>
		<link>http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing/comment-page-1#comment-6657</link>
		<dc:creator>links for 2009-03-14 &#171; Amy G. Dala</dc:creator>
		<pubDate>Sat, 14 Mar 2009 14:01:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing#comment-6657</guid>
		<description>[...] Ruby on Rails Password Hashing Module (tags: ruby rails security reference) [...]</description>
		<content:encoded><![CDATA[<p>[...] Ruby on Rails Password Hashing Module (tags: ruby rails security reference) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: valley</title>
		<link>http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing/comment-page-1#comment-4277</link>
		<dc:creator>valley</dc:creator>
		<pubDate>Mon, 10 Nov 2008 14:10:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing#comment-4277</guid>
		<description>In Password.salt  what do i have to enter for salt = .. ?
Whatever i take i get an error 

TypeError (can&#039;t convert Fixnum into String):
    /lib/password.rb:33:in `+&#039;
    /lib/password.rb:33:in `salt&#039;
    /lib/password.rb:9:in `update&#039;

in Password.store, and the salt value is never 64 chars long.</description>
		<content:encoded><![CDATA[<p>In Password.salt  what do i have to enter for salt = .. ?<br />
Whatever i take i get an error </p>
<p>TypeError (can&#8217;t convert Fixnum into String):<br />
    /lib/password.rb:33:in `+&#8217;<br />
    /lib/password.rb:33:in `salt&#8217;<br />
    /lib/password.rb:9:in `update&#8217;</p>
<p>in Password.store, and the salt value is never 64 chars long.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hugo Peixoto</title>
		<link>http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing/comment-page-1#comment-2655</link>
		<dc:creator>Hugo Peixoto</dc:creator>
		<pubDate>Sat, 06 Sep 2008 04:58:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing#comment-2655</guid>
		<description>@Thomas
Instead of before_create, you could use after_validate_on_create.</description>
		<content:encoded><![CDATA[<p>@Thomas<br />
Instead of before_create, you could use after_validate_on_create.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fophillips</title>
		<link>http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing/comment-page-1#comment-2061</link>
		<dc:creator>fophillips</dc:creator>
		<pubDate>Wed, 30 Jul 2008 00:59:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing#comment-2061</guid>
		<description>Is this code released under a specific license? I would like to use it in my project under the AGPL.</description>
		<content:encoded><![CDATA[<p>Is this code released under a specific license? I would like to use it in my project under the AGPL.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zachary Fox</title>
		<link>http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing/comment-page-1#comment-1741</link>
		<dc:creator>Zachary Fox</dc:creator>
		<pubDate>Fri, 11 Jul 2008 14:29:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing#comment-1741</guid>
		<description>@Thomas

Good points. These are very simplified examples of code that is in a CMS I wrote. I actually use a before_save method to check the values of password and password_verification fields (which are submitted from a form), along with additional validations to ensure that the password is valid (length, complexity, etc...)

For multiple reasons, I haven&#039;t provided complete examples, but enough that you can work with the password.rb lib.

I&#039;m glad you found it useful, and I&#039;ll look into the source files to see why the quotes aren&#039;t working properly.</description>
		<content:encoded><![CDATA[<p>@Thomas</p>
<p>Good points. These are very simplified examples of code that is in a CMS I wrote. I actually use a before_save method to check the values of password and password_verification fields (which are submitted from a form), along with additional validations to ensure that the password is valid (length, complexity, etc&#8230;)</p>
<p>For multiple reasons, I haven&#8217;t provided complete examples, but enough that you can work with the password.rb lib.</p>
<p>I&#8217;m glad you found it useful, and I&#8217;ll look into the source files to see why the quotes aren&#8217;t working properly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas</title>
		<link>http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing/comment-page-1#comment-1740</link>
		<dc:creator>Thomas</dc:creator>
		<pubDate>Fri, 11 Jul 2008 13:51:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.zacharyfox.com/blog/ruby-on-rails/password-hashing#comment-1740</guid>
		<description>I have to comment myself:

the assignment-method works, but the cost is, you cannot validate the password (e.g. against a minimum length), because validations uses the hashed value of the password. A better approach is:

  protected
  def before_save
    self.password = Password::update(self.password) if self.password_changed?
  end


But even here, you have to validate like this:

  def validate
    if self.password_changed?
      errors.add(&quot;password&quot;, &quot;at least 10 characters&quot;) if self.password.length &lt; 10
    end
  end


since all other validation-methods will use the hashed-version of the password, when you e.g. change some other attribute but not the password.

Best regards
Thomas</description>
		<content:encoded><![CDATA[<p>I have to comment myself:</p>
<p>the assignment-method works, but the cost is, you cannot validate the password (e.g. against a minimum length), because validations uses the hashed value of the password. A better approach is:</p>
<p>  protected<br />
  def before_save<br />
    self.password = Password::update(self.password) if self.password_changed?<br />
  end</p>
<p>But even here, you have to validate like this:</p>
<p>  def validate<br />
    if self.password_changed?<br />
      errors.add(&#8221;password&#8221;, &#8220;at least 10 characters&#8221;) if self.password.length &lt; 10<br />
    end<br />
  end</p>
<p>since all other validation-methods will use the hashed-version of the password, when you e.g. change some other attribute but not the password.</p>
<p>Best regards<br />
Thomas</p>
]]></content:encoded>
	</item>
</channel>
</rss>
