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



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