From 23913850609716cad2f43be9e84bddef6fc0f948 Mon Sep 17 00:00:00 2001 From: knu Date: Wed, 11 Oct 2006 17:16:27 +0000 Subject: [PATCH] * 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 --- ChangeLog | 4 ++++ ext/digest/lib/digest/hmac.rb | 8 +------- 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 + + * ext/digest/lib/digest/hmac.rb: Make use of String#bytes. + Thu Oct 12 02:12:31 2006 Akinori MUSHA * 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 }