From: yamaoka Date: Tue, 6 Jan 2004 22:26:42 +0000 (+0000) Subject: 2003-12-16 Simon Josefsson X-Git-Tag: flim-1_14_7~29 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=5b6828d178de88f5f773ecd427b96f3d8b2a9b10;p=elisp%2Fflim.git 2003-12-16 Simon Josefsson * sha1-el.el (autoload): Don't use ignore-errors. (sha1-use-external): Use condition-case. Suggested by Katsumi Yamaoka . 2003-12-15 Simon Josefsson * 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. 2001-12-29 ShengHuo ZHU * sha1-el.el (sha1-use-external): New variable. (sha1-region): Use it. (sha1-string): Ditto. --- diff --git a/ChangeLog b/ChangeLog index 118dda1..e934e6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2003-12-16 Simon Josefsson + + * sha1-el.el (autoload): Don't use ignore-errors. + (sha1-use-external): Use condition-case. Suggested by Katsumi + Yamaoka . + +2003-12-15 Simon Josefsson + + * 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. + +2001-12-29 ShengHuo ZHU + + * sha1-el.el (sha1-use-external): New variable. + (sha1-region): Use it. + (sha1-string): Ditto. + 2004-01-05 Katsumi Yamaoka * ntlm.el (ntlm-string-as-unibyte): New macro. diff --git a/sha1-el.el b/sha1-el.el index 15c1f5a..ab5804d 100644 --- a/sha1-el.el +++ b/sha1-el.el @@ -1,6 +1,6 @@ ;;; 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 ;; Keywords: SHA1, FIPS 180-1 @@ -54,20 +54,38 @@ (require 'hex-util) +(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) + +(defcustom sha1-use-external (condition-case () + (executable-find (car sha1-program)) + (error)) + "*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. @@ -396,17 +414,20 @@ It must be a string \(program name\) or list of strings \(name and its args\).") ;;; (defun sha1-region (beg end) - (if (and sha1-maximum-internal-length + (if (and sha1-use-external + sha1-maximum-internal-length (> (abs (- end beg)) sha1-maximum-internal-length)) (sha1-region-external beg end) (sha1-region-internal beg end))) (defun sha1-string (string) - (if (and sha1-maximum-internal-length + (if (and sha1-use-external + sha1-maximum-internal-length (> (length string) sha1-maximum-internal-length)) (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.