SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist
    Join Date
    Sep 2006
    Posts
    428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Rails 1.8 password encryption php interpret?

    Hello all, I have a client with an older Rails 1.8 app (was recently upgraded from 1.6) and I need to integrate a php site into the same user login creds.

    I'm not very versed with Ruby but I think this is the code that encrypts the password.

    Code:
      
      # Encrypts some data with the salt.
      def self.encrypt(password, salt)
        Digest::SHA1.hexdigest("--#{salt}--#{password}--")
      end
    
      # Encrypts the password with the user salt
      def encrypt(password)
        self.class.encrypt(password, salt)
      end
    So.... I have full db access so I have the encrypted passwords and their associated salts. And I need my php script to verify users. Is there as way for me to un-encrypt this password via php and the database that Ruby is using?

    Thanks in advance for any guidance or assistance you may be able to provide.

  2. #2
    SitePoint Evangelist
    Join Date
    Sep 2006
    Posts
    428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol, isn't it funny how right after you post the answer hits you right between the eyes?

    This is just an sha1() hash being used. So php should be able to use the salt and the pw to create a hash with sha1() function. I guess the whole 'hexdigest' thing is what confused me.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •