2003-12-15 Simon Josefsson <jas@extundo.com>
+ * sha1-el.el (autoload): Ignore errors for
+ executable-find. (XEmacs ecrypto does not require sh-script where
+ executable.el is located.)
+ (sha1-use-external): Likewise.
+
+ * sha1-el.el (sha1): Add defgroup.
+ (sha1-maximum-internal-length, sha1-program, sha1-use-external)
+ (sha1-program): Use 'sha1sum' from GNU CoreUtils instead of OpenSSL.
+ (sha1): Autoload.
+
* nndraft.el (nndraft-request-move-article): Copy definition of
nnmh-request-move-article instead of calling it, because the nnmh
version uses nnmh-request-article which isn't the same as the
;;; sha1-el.el --- SHA1 Secure Hash Algorithm in Emacs-Lisp.
-;; Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001, 2003 Free Software Foundation, Inc.
;; Author: Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
;; Keywords: SHA1, FIPS 180-1
(require 'hex-util)
-(autoload 'executable-find "executable")
+(ignore-errors (autoload 'executable-find "executable"))
;;;
;;; external SHA1 function.
;;;
-(defvar sha1-maximum-internal-length 500
+(defgroup sha1 nil
+ "Elisp interface for SHA1 hash computation."
+ :group 'extensions)
+
+(defcustom sha1-maximum-internal-length 500
"*Maximum length of message to use lisp version of SHA1 function.
If message is longer than this, `sha1-program' is used instead.
If this variable is set to 0, use extarnal program only.
-If this variable is set to nil, use internal function only.")
+If this variable is set to nil, use internal function only."
+ :type 'integer
+ :group 'sha1)
-(defvar sha1-program '("openssl" "sha1")
+(defcustom sha1-program '("sha1sum")
"*Name of program to compute SHA1.
-It must be a string \(program name\) or list of strings \(name and its args\).")
+It must be a string \(program name\) or list of strings \(name and its args\)."
+ :type '(repeat string)
+ :group 'sha1)
-(defvar sha1-use-external
- (exec-installed-p (car sha1-program))
- "*Use external sha1 program.
-If this variable is set to nil, use internal function only.")
+(defcustom sha1-use-external (ignore-errors
+ (executable-find (car sha1-program)))
+ "*Use external SHA1 program.
+If this variable is set to nil, use internal function only."
+ :type 'boolean
+ :group 'sha1)
(defun sha1-string-external (string)
;; `with-temp-buffer' is new in v20, so we do not use it.
(sha1-string-external string)
(sha1-string-internal string)))
+;;;###autoload
(defun sha1 (object &optional beg end)
"Return the SHA1 (Secure Hash Algorithm) of an object.
OBJECT is either a string or a buffer.