aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-11-10 11:56:26 +0000
committerDave Love2000-11-10 11:56:26 +0000
commit30d276a40295e56768cd6328317900751f8fceb1 (patch)
tree927e14043e924e2a732e9b1cb3f51021f76a92b6
parentdaaeed873e1daa736155e5845f35b2fcc478cf99 (diff)
downloademacs-30d276a40295e56768cd6328317900751f8fceb1.tar.gz
emacs-30d276a40295e56768cd6328317900751f8fceb1.zip
*** empty log message ***
-rw-r--r--lisp/gnus/ChangeLog11
-rw-r--r--lisp/md5.el79
2 files changed, 90 insertions, 0 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index c53be3a0352..f1f480ca3de 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,14 @@
12000-11-10 Dave Love <fx@gnu.org>
2
3 * pop3.el (pop3-version): Deleted.
4 (pop3-make-date): New function, avoiding message-make-date.
5 (pop3-munge-message-separator): Use it.
6
72000-11-10 ShengHuo ZHU <zsh@cs.rochester.edu>
8
9 * pop3.el (pop3-munge-message-separator): A message may have an
10 empty body.
11
12000-11-09 Dave Love <fx@gnu.org> 122000-11-09 Dave Love <fx@gnu.org>
2 13
3 * gnus-group.el (gnus-group-make-directory-group) 14 * gnus-group.el (gnus-group-make-directory-group)
diff --git a/lisp/md5.el b/lisp/md5.el
new file mode 100644
index 00000000000..3064e974a3a
--- /dev/null
+++ b/lisp/md5.el
@@ -0,0 +1,79 @@
1;;; md5.el --- MD5 message digest calculation (RFC 1321)
2
3;; Copyright (C) 2000 Free Software Foundation, Inc.
4
5;; Author: Dave Love <fx@gnu.org>
6;; Keywords: mail, processes, tools
7
8;; This file is free software; you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation; either version 2, or (at your option)
11;; any later version.
12
13;; This file is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details.
17
18;; You should have received a copy of the GNU General Public License
19;; along with GNU Emacs; see the file COPYING. If not, write to
20;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21;; Boston, MA 02111-1307, USA.
22
23;;; Commentary:
24
25;; Provides the `md5' function for computing the MD5 `message
26;; digest'/`fingerprint'/`checksum' for a string or buffer. This is
27;; compatible with the XEmacs version. We expect to have primitive
28;; MD5 support in a future version of Emacs.
29
30;; MD5 is defined in RFC 1321.
31
32;;; Code:
33
34;; Not worth customizing? Will go away anyhow with primitive support.
35(defvar md5-program "md5sum"
36 "Name of a program to calculate MD5 (message digest) checksums.
37This should read standard input and output the MD5 checksum in the
38first 32 bytes of standard output. `md5sum' is in GNU Textutils. An
39alternative is `md5', present in the SSLeay distribution.")
40
41;;;###autoload
42(defun md5 (object &optional start end encoding noerror)
43 "Return the MD5 message digest (checksum or fingerprint) of OBJECT.
44OBJECT is a buffer or a atring. Optional arguments START and END
45specify a region of the object to use, where the first character is 1
46for both buffers and strings.
47
48Optional argument ENCODING specifies a coding system with which to
49encode the text for computing the digest. If omitted, the normal
50rules will be used to find a coding system for output to
51`md5-program'. It probably makes most sense to use unibyte data and
52`binary' encoding. Optional argument NOERROR is for XEmacs
53compatibility and is ignored.
54
55In this implementation, the program named by `md5-program' is run to
56do the calculation.
57
58MD5 is defined in RFC 1321."
59 (with-temp-buffer
60 (let ((in-buffer (current-buffer))
61 (out-buffer (current-buffer)))
62 (if (stringp object)
63 (insert object)
64 (setq in-buffer object))
65 (goto-char (point-min))
66 (unless encoding
67 (setq encoding coding-system-for-write))
68 (with-current-buffer in-buffer
69 (let ((coding-system-for-write encoding))
70 (unless (eq 0 (call-process-region (or start (point-min))
71 (or end (point-max))
72 md5-program nil out-buffer))
73 (error "Running MD5 command %s failed"
74 (cons md5-program md5-program-args)))))
75 ;; The meaningful output is the first 32 characters.
76 ;; Don't return the newline that follows them!
77 (buffer-substring 1 33))))
78
79;;; md5.el ends here