lib/active_ldap/user_password.rb in activeldap-4.0.1 vs lib/active_ldap/user_password.rb in activeldap-4.0.2
- old
+ new
@@ -52,11 +52,11 @@
if salt and salt.size < 4
raise ArgumentError, _("salt size must be >= 4: %s") % salt.inspect
end
salt ||= Salt.generate(4)
md5_hash_with_salt = "#{Digest::MD5.digest(password + salt)}#{salt}"
- "{SMD5}#{[md5_hash_with_salt].pack('m').chomp}"
+ "{SMD5}#{[md5_hash_with_salt].pack('m').gsub("\n", '')}"
end
def extract_salt_for_smd5(smd5ed_password)
extract_salt_at_pos(smd5ed_password, 16)
end
@@ -69,10 +69,10 @@
if salt and salt.size < 4
raise ArgumentError, _("salt size must be >= 4: %s") % salt.inspect
end
salt ||= Salt.generate(4)
sha1_hash_with_salt = "#{Digest::SHA1.digest(password + salt)}#{salt}"
- "{SSHA}#{[sha1_hash_with_salt].pack('m').chomp}"
+ "{SSHA}#{[sha1_hash_with_salt].pack('m').gsub("\n", '')}"
end
def extract_salt_for_ssha(sshaed_password)
extract_salt_at_pos(sshaed_password, 20)
end