From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Cc: ding@gnus.org, Kenichi Handa <handa@m17n.org>
Subject: Re: rfc2104 change on 2008-02-01
Date: Fri, 25 Apr 2008 10:28:12 -0400 [thread overview]
Message-ID: <jwvzlrinhw5.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87iqy6cj1f.fsf@mocca.josefsson.org> (Simon Josefsson's message of "Fri, 25 Apr 2008 12:42:36 +0200")
> 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 <handa@m17n.org>
> * 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)
next prev parent reply other threads:[~2008-04-25 14:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-25 10:42 rfc2104 change on 2008-02-01 Simon Josefsson
2008-04-25 11:37 ` Reiner Steib
2008-04-25 13:40 ` Simon Josefsson
2008-04-25 16:03 ` Thien-Thi Nguyen
2008-04-25 14:28 ` Stefan Monnier [this message]
2008-04-26 6:59 ` Gabor Z. Papp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvzlrinhw5.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=ding@gnus.org \
--cc=emacs-devel@gnu.org \
--cc=handa@m17n.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.