changeset 89617:f7f76c4ee683

* 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.
author Kenichi Handa <handa@m17n.org>
date Thu, 13 Nov 2003 08:49:29 +0000
parents 3c6a6f43d21b
children 98233009d16c
files lisp/gnus/rfc2104.el
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/rfc2104.el	Thu Nov 13 06:04:36 2003 +0000
+++ b/lisp/gnus/rfc2104.el	Thu Nov 13 08:49:29 2003 +0000
@@ -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)