Commit 30d276a4 authored by Dave Love's avatar Dave Love
Browse files

*** empty log message ***

parent daaeed87
2000-11-10 Dave Love <>
* pop3.el (pop3-version): Deleted.
(pop3-make-date): New function, avoiding message-make-date.
(pop3-munge-message-separator): Use it.
2000-11-10 ShengHuo ZHU <>
* pop3.el (pop3-munge-message-separator): A message may have an
empty body.
2000-11-09 Dave Love <>
* gnus-group.el (gnus-group-make-directory-group)
;;; md5.el --- MD5 message digest calculation (RFC 1321)
;; Copyright (C) 2000 Free Software Foundation, Inc.
;; Author: Dave Love <>
;; Keywords: mail, processes, tools
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;; Provides the `md5' function for computing the MD5 `message
;; digest'/`fingerprint'/`checksum' for a string or buffer. This is
;; compatible with the XEmacs version. We expect to have primitive
;; MD5 support in a future version of Emacs.
;; MD5 is defined in RFC 1321.
;;; Code:
;; Not worth customizing? Will go away anyhow with primitive support.
(defvar md5-program "md5sum"
"Name of a program to calculate MD5 (message digest) checksums.
This should read standard input and output the MD5 checksum in the
first 32 bytes of standard output. `md5sum' is in GNU Textutils. An
alternative is `md5', present in the SSLeay distribution.")
(defun md5 (object &optional start end encoding noerror)
"Return the MD5 message digest (checksum or fingerprint) of OBJECT.
OBJECT is a buffer or a atring. Optional arguments START and END
specify a region of the object to use, where the first character is 1
for both buffers and strings.
Optional argument ENCODING specifies a coding system with which to
encode the text for computing the digest. If omitted, the normal
rules will be used to find a coding system for output to
`md5-program'. It probably makes most sense to use unibyte data and
`binary' encoding. Optional argument NOERROR is for XEmacs
compatibility and is ignored.
In this implementation, the program named by `md5-program' is run to
do the calculation.
MD5 is defined in RFC 1321."
(let ((in-buffer (current-buffer))
(out-buffer (current-buffer)))
(if (stringp object)
(insert object)
(setq in-buffer object))
(goto-char (point-min))
(unless encoding
(setq encoding coding-system-for-write))
(with-current-buffer in-buffer
(let ((coding-system-for-write encoding))
(unless (eq 0 (call-process-region (or start (point-min))
(or end (point-max))
md5-program nil out-buffer))
(error "Running MD5 command %s failed"
(cons md5-program md5-program-args)))))
;; The meaningful output is the first 32 characters.
;; Don't return the newline that follows them!
(buffer-substring 1 33))))
;;; md5.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment