Object
Generate a password-hash suitable for inclusion in an LDAP attribute. Pass a hash type (currently supported: :md5 and :sha) and a plaintext password. This function will return a hashed representation.
STUB: This is here to fulfill the requirements of an RFC, which one?
TODO, gotta do salted-sha and (maybe) salted-md5. Should we provide sha1 as a synonym for sha1? I vote no because then should you also provide ssha1 for symmetry?
# File lib/net/ldap/psw.rb, line 41 41: def generate(type, str) 42: digest, digest_name = case type 43: when :md5 44: [Digest::MD5.new, 'MD5'] 45: when :sha 46: [Digest::SHA1.new, 'SHA'] 47: else 48: raise Net::LDAP::LdapError.new("unsupported password-hash type (#{type})") 49: end 50: 51: digest << str.to_s 52: return "{#{digest_name}}#{[digest.digest].pack('m').chomp }" 53: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.