From a62e3ee2c810393c438a34c8aeb10f87e53c256f Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Thu, 13 Nov 2003 08:49:29 +0000 Subject: [PATCH] * rfc2104.el (rfc2104-hexstring-to-byte-list): Renamed from rfc2104-hexstring-to-bitstring and changed to return a byte list. (rfc2104-hash): Convert the result of concat to unibyte string. --- lisp/gnus/rfc2104.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lisp/gnus/rfc2104.el b/lisp/gnus/rfc2104.el index 5496a4f81bf..916eea4367d 100644 --- a/lisp/gnus/rfc2104.el +++ b/lisp/gnus/rfc2104.el @@ -51,6 +51,7 @@ ;;; 1999-10-23 included in pgnus ;;; 2000-08-15 `rfc2104-hexstring-to-bitstring' ;;; 2000-05-12 added sha-1 example, added test case reference +;;; 2003-11-13 change rfc2104-hexstring-to-bitstring to ...-byte-list ;;; Code: @@ -86,12 +87,12 @@ (rfc2104-hex-to-int (reverse (append str nil)))) 0)) -(defun rfc2104-hexstring-to-bitstring (str) +(defun rfc2104-hexstring-to-byte-list (str) (let (out) (while (< 0 (length str)) (push (rfc2104-hex-to-int (substring str -2)) out) (setq str (substring str 0 -2))) - (concat out))) + out)) (defun rfc2104-hash (hash block-length hash-length key text) (let* (;; if key is longer than B, reset it to HASH(key) @@ -108,9 +109,12 @@ (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 (concat k_opad (rfc2104-hexstring-to-bitstring - ;; perform inner hash - (funcall hash (concat k_ipad text))))))) + (funcall hash + (encode-coding-string + (concat k_opad (rfc2104-hexstring-to-byte-list + ;; perform inner hash + (funcall hash (concat k_ipad text)))) + 'iso-latin-1)))) (provide 'rfc2104) -- 2.39.2