Permalink
Browse files

Ruby 1.8.6 compatibility: the bundled mysql.rb had used deprecated Di…

…gest::SHA1.new(...).digest instead of Digest::SHA1.digest(...)

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-stable@6328 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent bbe3dea commit 633d7579cf0b1144f4db57013c7b034d5621be7a @jeremy jeremy committed Mar 4, 2007
Showing with 3 additions and 3 deletions.
  1. +3 −3 activerecord/lib/active_record/vendor/mysql.rb
View
6 activerecord/lib/active_record/vendor/mysql.rb
@@ -563,9 +563,9 @@ def scramble(password, message, old_ver)
def scramble41(password, message)
return 0x00.chr if password.nil? or password.empty?
buf = [0x14]
- s1 = Digest::SHA1.new(password).digest
- s2 = Digest::SHA1.new(s1).digest
- x = Digest::SHA1.new(message + s2).digest
+ s1 = Digest::SHA1.digest(password)
+ s2 = Digest::SHA1.digest(s1)
+ x = Digest::SHA1.digest(message + s2)
(0..s1.length - 1).each {|i| buf.push(s1[i] ^ x[i])}
buf.pack("C*")
end

0 comments on commit 633d757

Please sign in to comment.