mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
9b81e26df2
commit
2391385060
2 changed files with 5 additions and 7 deletions
|
@ -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>
|
Thu Oct 12 02:12:31 2006 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
* ext/digest/digest.c (get_digest_base_metadata): Use an instance
|
* ext/digest/digest.c (get_digest_base_metadata): Use an instance
|
||||||
|
|
|
@ -54,16 +54,10 @@ module Digest
|
||||||
ipad = Array.new(BLOCK_LENGTH).fill(0x36)
|
ipad = Array.new(BLOCK_LENGTH).fill(0x36)
|
||||||
opad = Array.new(BLOCK_LENGTH).fill(0x5c)
|
opad = Array.new(BLOCK_LENGTH).fill(0x5c)
|
||||||
|
|
||||||
i = 0
|
KEY.bytes.each_with_index { |c, i|
|
||||||
KEY.each_byte { |c|
|
|
||||||
ipad[i] ^= c
|
ipad[i] ^= c
|
||||||
opad[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 }
|
@ipad = ipad.inject('') { |s, c| s << c.chr }
|
||||||
@opad = opad.inject('') { |s, c| s << c.chr }
|
@opad = opad.inject('') { |s, c| s << c.chr }
|
||||||
|
|
Loading…
Reference in a new issue