Salted hash login generator

Hi - if you can't get this to work you could try building your own?

Class User

before_create :create_salt

  def create_salt
    unless self.salt
      self.salt = random_salt

  def random_salt
    nums = ("0".."9").to_a
    random = ""
    1.upto(5) { |i| newrand << numbers[rand(numbers.size - 1)]}
    return random

  def hash_password
    update_attribute :password, Digest::MD5.hexdigest("#{self.salt}#

  def password_matches? password_to_match
     password == Digest::MD5.hexdigest("#{self.salt}#

Just call hash_password after you save the user or update the password
and call password_matches? to check that the password provided is the
correct one.

Hope that helps?