Sha256: 75c6fe2316926b92cc7933130fe5384a6449070511352ffacefb0c8e7fd7015e

Contents?: true

Size: 485 Bytes

Versions: 5

Compression:

Stored size: 485 Bytes

Contents

module Ixtlan
  class Digest
    # method from openldap faq which produces the userPassword attribute
    # for the ldap
    # @param secret String the password
    # @param salt String the salt for the password digester
    # @return the encoded password/salt
    def self.ssha(secret, salt)
      require 'sha1' 
      require 'base64' 
      (salt.empty? ? "{SHA}": "{SSHA}") +  
        Base64.encode64(::Digest::SHA1.digest(secret + salt) + salt).gsub(/\n/, '')
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ixtlan-0.2.4 lib/ixtlan/digest.rb
ixtlan-0.2.3 lib/ixtlan/digest.rb
ixtlan-0.2.2 lib/ixtlan/digest.rb
ixtlan-0.2.1 lib/ixtlan/digest.rb
ixtlan-0.2.0 lib/ixtlan/digest.rb