From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/66877 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel,gmane.emacs.gnus.general Subject: Re: rfc2104 change on 2008-02-01 Date: Fri, 25 Apr 2008 10:28:12 -0400 Message-ID: References: <87iqy6cj1f.fsf@mocca.josefsson.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1209133773 28559 80.91.229.12 (25 Apr 2008 14:29:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Apr 2008 14:29:33 +0000 (UTC) Cc: ding@gnus.org, Kenichi Handa To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 25 16:30:05 2008 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JpOw5-0008Fs-S4 for ged-emacs-devel@m.gmane.org; Fri, 25 Apr 2008 16:30:02 +0200 Original-Received: from localhost ([127.0.0.1]:35151 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JpOvP-0005Ao-Lb for ged-emacs-devel@m.gmane.org; Fri, 25 Apr 2008 10:29:19 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JpOuP-000447-Jp for emacs-devel@gnu.org; Fri, 25 Apr 2008 10:28:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JpOuN-00042a-Rs for emacs-devel@gnu.org; Fri, 25 Apr 2008 10:28:17 -0400 Original-Received: from [199.232.76.173] (port=44110 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JpOuN-00042U-PQ for emacs-devel@gnu.org; Fri, 25 Apr 2008 10:28:15 -0400 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182] helo=ironport2-out.teksavvy.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JpOuN-0003BY-IT for emacs-devel@gnu.org; Fri, 25 Apr 2008 10:28:15 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvYEAE+HEUhMCpew/2dsb2JhbACBUqp0 X-IronPort-AV: E=Sophos;i="4.25,707,1199682000"; d="scan'208";a="19184696" Original-Received: from smtp.pppoe.ca (HELO smtp.teksavvy.com) ([65.39.196.238]) by ironport2-out.teksavvy.com with ESMTP; 25 Apr 2008 10:28:12 -0400 Original-Received: from pastel.home ([76.10.151.176]) by smtp.teksavvy.com (Internet Mail Server v1.0) with ESMTP id FSB65612; Fri, 25 Apr 2008 10:28:12 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id A924A8568; Fri, 25 Apr 2008 10:28:12 -0400 (EDT) In-Reply-To: <87iqy6cj1f.fsf@mocca.josefsson.org> (Simon Josefsson's message of "Fri, 25 Apr 2008 12:42:36 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:95942 gmane.emacs.gnus.general:66877 Archived-At: > I have tracked down a problem sending authenticated e-mail that resulted > in randomly failed CRAM-MD5 authentication (it sometimes work, usually > after 2-3 retries). The cause is: > 2008-02-01 Kenichi Handa > * rfc2104.el (rfc2104-hexstring-to-byte-list): Renamed from > rfc2104-hexstring-to-bitstring and changed to return a byte list. This might be the problem: why return a byte-list rather than a unicode string? How 'bout the patch below? Stefan --- rfc2104.el.~1.14.~ 2008-04-10 21:03:54.000000000 -0400 +++ rfc2104.el 2008-04-25 10:27:16.000000000 -0400 @@ -89,12 +89,12 @@ (rfc2104-hex-to-int (reverse (append str nil)))) 0)) -(defun rfc2104-hexstring-to-byte-list (str) +(defun rfc2104-hexstring-to-bitstring (str) (let (out) (while (< 0 (length str)) (push (rfc2104-hex-to-int (substring str -2)) out) (setq str (substring str 0 -2))) - out)) + (apply (if (fboundp 'unibyte-string) 'unibyte-string 'string) out))) (defun rfc2104-hash (hash block-length hash-length key text) (let* (;; if key is longer than B, reset it to HASH(key) @@ -111,12 +111,9 @@ (setq k_ipad (mapcar (lambda (c) (logxor c rfc2104-ipad)) k_ipad)) (setq k_opad (mapcar (lambda (c) (logxor c rfc2104-opad)) k_opad)) ;; perform outer hash - (funcall hash - (encode-coding-string - (concat k_opad (rfc2104-hexstring-to-byte-list + (funcall hash (concat k_opad (rfc2104-hexstring-to-bitstring ;; perform inner hash - (funcall hash (concat k_ipad text)))) - 'iso-latin-1)))) + (funcall hash (concat k_ipad text))))))) (provide 'rfc2104)