Sha256: 15593fff4256d8f851741711eafa79138aef6c87c53e20ca2343f2103cb8bab0

Contents?: true

Size: 481 Bytes

Versions: 10

Compression:

Stored size: 481 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

10 entries across 10 versions & 1 rubygems

Version Path
ixtlan-0.4.3 lib/ixtlan/digest.rb
ixtlan-0.4.2 lib/ixtlan/digest.rb
ixtlan-0.4.1 lib/ixtlan/digest.rb
ixtlan-0.4.0 lib/ixtlan/digest.rb
ixtlan-0.4.0.pre5 lib/ixtlan/digest.rb
ixtlan-0.4.0.pre4 lib/ixtlan/digest.rb
ixtlan-0.4.0.pre3 lib/ixtlan/digest.rb
ixtlan-0.4.0.pre2 lib/ixtlan/digest.rb
ixtlan-0.4.0.pre lib/ixtlan/digest.rb
ixtlan-0.3.0 lib/ixtlan/digest.rb