;;; rfc2104.el --- RFC2104 Hashed Message Authentication Codes
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
;;; 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.
;;; 1999-10-23 included in pgnus
;;; 2000-08-15 `rfc2104-hexstring-to-bitstring'
;;; 2000-05-12 added sha-1 example, added test case reference
;;; 1999-10-23 included in pgnus
;;; 2000-08-15 `rfc2104-hexstring-to-bitstring'
;;; 2000-05-12 added sha-1 example, added test case reference
(let (out)
(while (< 0 (length str))
(push (rfc2104-hex-to-int (substring str -2)) out)
(setq str (substring str 0 -2)))
(let (out)
(while (< 0 (length str))
(push (rfc2104-hex-to-int (substring str -2)) out)
(setq str (substring str 0 -2)))
(defun rfc2104-hash (hash block-length hash-length key text)
(let* (;; if key is longer than B, reset it to HASH(key)
(defun rfc2104-hash (hash block-length hash-length key text)
(let* (;; if key is longer than B, reset it to HASH(key)
(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
(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