Class: Ixtlan::Digest

Inherits:
Object
  • Object
show all
Defined in:
lib/ixtlan/digest.rb

Class Method Summary collapse

Class Method Details

.ssha(secret, salt) ⇒ Object

method from openldap faq which produces the userPassword attribute for the ldap

Parameters:

  • secret

    String the password

  • salt

    String the salt for the password digester

Returns:

  • the encoded password/salt



8
9
10
11
12
13
# File 'lib/ixtlan/digest.rb', line 8

def self.ssha(secret, salt)
  require 'sha1'
  require 'base64'
  (salt.empty? ? "{SHA}": "{SSHA}") +
    Base64.encode64(::Digest::SHA1.digest(secret + salt) + salt).gsub(/\n/, '')
end