diff options
| author | Kenichi Handa | 2003-11-13 08:49:29 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2003-11-13 08:49:29 +0000 |
| commit | a62e3ee2c810393c438a34c8aeb10f87e53c256f (patch) | |
| tree | efd912da26dfc003df9460fa681face3b72d8460 | |
| parent | 93ff0d1e6630cbf666d25b7ec4360d75d4b2d87d (diff) | |
| download | emacs-a62e3ee2c810393c438a34c8aeb10f87e53c256f.tar.gz emacs-a62e3ee2c810393c438a34c8aeb10f87e53c256f.zip | |
* 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.
| -rw-r--r-- | lisp/gnus/rfc2104.el | 14 |
1 files 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 @@ | |||
| 51 | ;;; 1999-10-23 included in pgnus | 51 | ;;; 1999-10-23 included in pgnus |
| 52 | ;;; 2000-08-15 `rfc2104-hexstring-to-bitstring' | 52 | ;;; 2000-08-15 `rfc2104-hexstring-to-bitstring' |
| 53 | ;;; 2000-05-12 added sha-1 example, added test case reference | 53 | ;;; 2000-05-12 added sha-1 example, added test case reference |
| 54 | ;;; 2003-11-13 change rfc2104-hexstring-to-bitstring to ...-byte-list | ||
| 54 | 55 | ||
| 55 | ;;; Code: | 56 | ;;; Code: |
| 56 | 57 | ||
| @@ -86,12 +87,12 @@ | |||
| 86 | (rfc2104-hex-to-int (reverse (append str nil)))) | 87 | (rfc2104-hex-to-int (reverse (append str nil)))) |
| 87 | 0)) | 88 | 0)) |
| 88 | 89 | ||
| 89 | (defun rfc2104-hexstring-to-bitstring (str) | 90 | (defun rfc2104-hexstring-to-byte-list (str) |
| 90 | (let (out) | 91 | (let (out) |
| 91 | (while (< 0 (length str)) | 92 | (while (< 0 (length str)) |
| 92 | (push (rfc2104-hex-to-int (substring str -2)) out) | 93 | (push (rfc2104-hex-to-int (substring str -2)) out) |
| 93 | (setq str (substring str 0 -2))) | 94 | (setq str (substring str 0 -2))) |
| 94 | (concat out))) | 95 | out)) |
| 95 | 96 | ||
| 96 | (defun rfc2104-hash (hash block-length hash-length key text) | 97 | (defun rfc2104-hash (hash block-length hash-length key text) |
| 97 | (let* (;; if key is longer than B, reset it to HASH(key) | 98 | (let* (;; if key is longer than B, reset it to HASH(key) |
| @@ -108,9 +109,12 @@ | |||
| 108 | (setq k_ipad (mapcar (lambda (c) (logxor c rfc2104-ipad)) k_ipad)) | 109 | (setq k_ipad (mapcar (lambda (c) (logxor c rfc2104-ipad)) k_ipad)) |
| 109 | (setq k_opad (mapcar (lambda (c) (logxor c rfc2104-opad)) k_opad)) | 110 | (setq k_opad (mapcar (lambda (c) (logxor c rfc2104-opad)) k_opad)) |
| 110 | ;; perform outer hash | 111 | ;; perform outer hash |
| 111 | (funcall hash (concat k_opad (rfc2104-hexstring-to-bitstring | 112 | (funcall hash |
| 112 | ;; perform inner hash | 113 | (encode-coding-string |
| 113 | (funcall hash (concat k_ipad text))))))) | 114 | (concat k_opad (rfc2104-hexstring-to-byte-list |
| 115 | ;; perform inner hash | ||
| 116 | (funcall hash (concat k_ipad text)))) | ||
| 117 | 'iso-latin-1)))) | ||
| 114 | 118 | ||
| 115 | (provide 'rfc2104) | 119 | (provide 'rfc2104) |
| 116 | 120 | ||