aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--ext/digest/lib/digest/hmac.rb8
2 files changed, 5 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index e777277310..3d1004ff18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Oct 12 02:15:24 2006 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/lib/digest/hmac.rb: Make use of String#bytes.
+
Thu Oct 12 02:12:31 2006 Akinori MUSHA <knu@iDaemons.org>
* ext/digest/digest.c (get_digest_base_metadata): Use an instance
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 }