[前][次][番号順一覧][スレッド一覧]

ruby-changes:10446

From: shugo <ko1@a...>
Date: Tue, 3 Feb 2009 12:12:43 +0900 (JST)
Subject: [ruby-changes:10446] Ruby:r21996 (trunk): * lib/net/imap.rb (hmac_md5): should use String#ord to get ascii

shugo	2009-02-03 12:12:30 +0900 (Tue, 03 Feb 2009)

  New Revision: 21996

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21996

  Log:
    * lib/net/imap.rb (hmac_md5): should use String#ord to get ascii
      code from the one-character string.

  Modified files:
    trunk/ChangeLog
    trunk/lib/net/imap.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 21995)
+++ ChangeLog	(revision 21996)
@@ -1,3 +1,8 @@
+Tue Feb  3 12:09:08 2009  Shugo Maeda  <shugo@r...>
+
+	* lib/net/imap.rb (hmac_md5): should use String#ord to get ascii
+	  code from the one-character string.
+
 Tue Feb  3 11:25:41 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* load.c (load_lock): warn for circular require.  [ruby-core:20794],
Index: lib/net/imap.rb
===================================================================
--- lib/net/imap.rb	(revision 21995)
+++ lib/net/imap.rb	(revision 21996)
@@ -3151,8 +3151,8 @@
         k_ipad = key + "\0" * (64 - key.length)
         k_opad = key + "\0" * (64 - key.length)
         for i in 0..63
-          k_ipad[i] ^= 0x36
-          k_opad[i] ^= 0x5c
+          k_ipad[i] = (k_ipad[i].ord ^ 0x36).chr
+          k_opad[i] = (k_opad[i].ord ^ 0x5c).chr
         end
 
         digest = Digest::MD5.digest(k_ipad + text)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]