Class: Ldap::Digest
- Inherits:
-
Object
- Object
- Ldap::Digest
- Defined in:
- lib/ldap/digest.rb
Class Method Summary collapse
-
.sha(secret) ⇒ Object
method from openldap faq which produces the userPassword attribute for the ldap.
-
.ssha(secret, salt) ⇒ Object
method from openldap faq which produces the userPassword attribute for the ldap.
Class Method Details
.sha(secret) ⇒ Object
method from openldap faq which produces the userPassword attribute for the ldap
26 27 28 |
# File 'lib/ldap/digest.rb', line 26 def self.sha(secret) ssha(secret, "") end |
.ssha(secret, salt) ⇒ Object
method from openldap faq which produces the userPassword attribute for the ldap
17 18 19 20 |
# File 'lib/ldap/digest.rb', line 17 def self.ssha(secret, salt) (salt.empty? ? "{SHA}": "{SSHA}") + Base64.encode64(::Digest::SHA1.digest(secret + salt) + salt).gsub(/\n/, '') end |