1 ;;; sha1.el --- SHA1 Secure Hash Algorithm.
3 ;; Copyright (C) 1999 Shuhei KOBAYASHI
5 ;; Author: Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
6 ;; Kenichi OKADA <okada@opaopa.org>
7 ;; Maintainer: Kenichi OKADA <okada@opaopa.org>
8 ;; Keywords: SHA1, FIPS 180-1
10 ;; This file is part of FLIM (Faithful Library about Internet Message).
12 ;; This program is free software; you can redistribute it and/or
13 ;; modify it under the terms of the GNU General Public License as
14 ;; published by the Free Software Foundation; either version 2, or
15 ;; (at your option) any later version.
17 ;; This program is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with this program; see the file COPYING. If not, write to
24 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
29 ;; Examples from FIPS PUB 180-1.
30 ;; <URL:http://www.itl.nist.gov/div897/pubs/fip180-1.htm>
33 ;; => a9993e364706816aba3e25717850c26c9cd0d89d
35 ;; (sha1 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")
36 ;; => 84983e441c3bd26ebaae4aa1f95129e5e54670f1
38 ;; (sha1 (make-string 1000000 ?a))
39 ;; => 34aa973cd4c4daa4f61eeb2bdbad27316534016f
46 (or (fboundp 'sha1-string)
47 (defun sha1-string (a))))
49 (defvar sha1-dl-module
50 (if (and (fboundp 'sha1-string)
51 (subrp (symbol-function 'sha1-string)))
53 (if (fboundp 'dynamic-link)
54 (let ((path (expand-file-name "sha1.so" exec-directory)))
55 (and (file-exists-p path)
60 ;; Emacs with DL patch.
65 ;; compatibility for another sha1.el by Keiichi Suzuki.
66 (defun sha1-encode (string)
68 (sha1-string string)))
69 (defun sha1-encode-binary (string)
71 (sha1-string string)))
73 (make-obsolete 'sha1-encode "It's old API.")
74 (make-obsolete 'sha1-encode-binary "It's old API.")