Synch to No Gnus 200402270146.
[elisp/gnus.git-] / lisp / canlock.el
index 310c9cf..6bdcd3b 100644 (file)
 (eval-when-compile
   (require 'cl))
 
-(autoload 'sha1 "sha1-el")
-(autoload 'sha1-binary "sha1-el")
-(autoload 'base64-encode-string "base64")
+(eval-and-compile
+  (require 'sha1-el)
+  (condition-case nil
+      (sha1 "" nil nil 'binary)
+    (wrong-number-of-arguments
+     (let ((mel (locate-library "mel")))
+       (when mel
+        (load (expand-file-name "sha1-el" (file-name-directory mel))
+              nil t))))))
+
 (autoload 'mail-fetch-field "mail-utils")
 (defvar mail-header-separator)
 
@@ -82,8 +89,9 @@ buffer does not look like a news message."
 (defun canlock-sha1 (message)
   "Make a SHA-1 digest of MESSAGE as a unibyte string of length 20 bytes."
   (condition-case nil
-      (sha1 message nil nil 'binary)
-    (error
+      (let (sha1-maximum-internal-length)
+       (sha1 message nil nil 'binary))
+    (wrong-number-of-arguments
      (canlock-string-as-unibyte (sha1-binary message)))))
 
 (defun canlock-make-cancel-key (message-id password)