1 ;;; sha1.el --- SHA1 Secure Hash Algorithm.
3 ;; Copyright (C) 1999 Shuhei KOBAYASHI
5 ;; Author: Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
6 ;; Keywords: SHA1, FIPS 180-1
8 ;; This file is part of FLIM (Faithful Library about Internet Message).
10 ;; This program is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or
13 ;; (at your option) any later version.
15 ;; This program is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with this program; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
27 ;; Examples from FIPS PUB 180-1.
28 ;; <URL:http://www.itl.nist.gov/div897/pubs/fip180-1.htm>
31 ;; => a9993e364706816aba3e25717850c26c9cd0d89d
33 ;; (sha1 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")
34 ;; => 84983e441c3bd26ebaae4aa1f95129e5e54670f1
36 ;; (sha1 (make-string 1000000 ?a))
37 ;; => 34aa973cd4c4daa4f61eeb2bdbad27316534016f
42 ((and (fboundp 'dynamic-link)
43 (file-exists-p (expand-file-name "sha1.so" exec-directory)))
44 ;; Emacs with DL patch.
45 (require 'sha1 "sha1-dl"))
47 (require 'sha1 "sha1-el")
48 (defun sha1 (object &optional beg end)
49 "Return the SHA1 (Secure Hash Algorithm) of an object.
50 OBJECT is either a string or a buffer.
51 Optional arguments BEG and END denote buffer positions for computing the
52 hash of a portion of OBJECT."
58 (buffer-substring-no-properties
59 (or beg (point-min)) (or end (point-max)))))))
62 ;;; sha1.el ends here.