diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-10-11 17:16:27 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-10-11 17:16:27 +0000 |
commit | 23913850609716cad2f43be9e84bddef6fc0f948 (patch) | |
tree | f4eb0f9a81036c560608d781082d4b0e7408ca5d /ext/digest/lib/digest/hmac.rb | |
parent | 9b81e26df274eb430e66a43408d8e76165e61c3d (diff) |
* ext/digest/lib/digest/hmac.rb: Make use of String#bytes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/digest/lib/digest/hmac.rb')
-rw-r--r-- | ext/digest/lib/digest/hmac.rb | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/ext/digest/lib/digest/hmac.rb b/ext/digest/lib/digest/hmac.rb index 3eb83e5ff5..e6870f95c1 100644 --- a/ext/digest/lib/digest/hmac.rb +++ b/ext/digest/lib/digest/hmac.rb @@ -54,16 +54,10 @@ module Digest ipad = Array.new(BLOCK_LENGTH).fill(0x36) opad = Array.new(BLOCK_LENGTH).fill(0x5c) - i = 0 - KEY.each_byte { |c| + KEY.bytes.each_with_index { |c, i| ipad[i] ^= c opad[i] ^= c - i += 1 } - #KEY.bytes.each_with_index { |c, i| - # ipad[i] ^= c - # opad[i] ^= c - #} @ipad = ipad.inject('') { |s, c| s << c.chr } @opad = opad.inject('') { |s, c| s << c.chr } |