mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/digest/lib/digest/hmac.rb (Digest::HMAC#initialize): faster
code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0ff3bf4f44
commit
69f1e595bf
2 changed files with 10 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
Fri Aug 14 16:28:19 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/digest/lib/digest/hmac.rb (Digest::HMAC#initialize): faster
|
||||
code.
|
||||
|
||||
Fri Aug 14 14:31:33 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* configure.in (rubyhdrdir): fixed typo. [ruby-dev:39079]
|
||||
|
|
|
@ -49,8 +49,8 @@ module Digest
|
|||
key = @md.digest(key)
|
||||
end
|
||||
|
||||
ipad = Array.new(block_len).fill(0x36)
|
||||
opad = Array.new(block_len).fill(0x5c)
|
||||
ipad = Array.new(block_len, 0x36)
|
||||
opad = Array.new(block_len, 0x5c)
|
||||
|
||||
key.bytes.each_with_index { |c, i|
|
||||
ipad[i] ^= c
|
||||
|
@ -58,8 +58,8 @@ module Digest
|
|||
}
|
||||
|
||||
@key = key.freeze
|
||||
@ipad = ipad.inject('') { |s, c| s << c.chr }.freeze
|
||||
@opad = opad.inject('') { |s, c| s << c.chr }.freeze
|
||||
@ipad = ipad.pack('C*').freeze
|
||||
@opad = opad.pack('C*').freeze
|
||||
@md.update(@ipad)
|
||||
end
|
||||
|
||||
|
@ -102,7 +102,7 @@ module Digest
|
|||
end
|
||||
|
||||
if $0 == __FILE__
|
||||
eval DATA.read, nil, $0, __LINE__+4
|
||||
eval DATA.gets(nil), nil, $0, DATA.lineno
|
||||
end
|
||||
|
||||
__END__
|
||||
|
|
Loading…
Reference in a new issue