X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/9899d01a0ccec166e04caa60657a44e614be50cd..cbee283dd7dd655124e81a6bd555506476180b5d:/lisp/gnus/rfc2104.el diff --git a/lisp/gnus/rfc2104.el b/lisp/gnus/rfc2104.el index 1c4fc9e2de..e88faf7265 100644 --- a/lisp/gnus/rfc2104.el +++ b/lisp/gnus/rfc2104.el @@ -1,7 +1,7 @@ ;;; rfc2104.el --- RFC2104 Hashed Message Authentication Codes ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007 Free Software Foundation, Inc. +;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. ;; Author: Simon Josefsson ;; Keywords: mail @@ -53,6 +53,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: @@ -88,12 +89,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) @@ -110,11 +111,14 @@ (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) -;;; arch-tag: cf671d5c-a45f-4a09-815e-704e59e43950 +;; arch-tag: cf671d5c-a45f-4a09-815e-704e59e43950 ;;; rfc2104.el ends here