(eword-decode-string, eword-decode-region): Mention language info in doc string.
[elisp/flim.git] / md5-dl.el
1 ;;; md5-dl.el --- MD5 Message Digest Algorithm using DL module.
2
3 ;; Copyright (C) 1999, 2001  Free Software Foundation, Inc.
4
5 ;; Author: Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
6 ;; Keywords: MD5, RFC 1321
7
8 ;; This file is part of FLIM (Faithful Library about Internet Message).
9
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.
14
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.
19
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., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
24
25 ;;; Commentary:
26
27 ;;; Code:
28
29 (provide 'md5-dl)                       ; beware of circular dependency.
30 (eval-when-compile (require 'md5))      ; md5-dl-module.
31
32 ;;; This file is loaded (from "md5.el") only when md5-dl-module is exists.
33 (defvar md5-dl-handle (dynamic-link md5-dl-module))
34
35 ;;; md5-dl-module provides `md5-string'.
36 (dynamic-call "emacs_md5_init" md5-dl-handle)
37
38 (defun md5-region (beg end)
39   (md5-string (buffer-substring-no-properties beg end)))
40
41 ;;; Note that v21 `md5' takes two more args: CODING and NOERROR.
42 (defun md5 (object &optional beg end)
43   "Return the MD5 (a secure message digest algorithm) of an object.
44 OBJECT is either a string or a buffer.
45 Optional arguments BEG and END denote buffer positions for computing the
46 hash of a portion of OBJECT."
47   (if (stringp object)
48       (md5-string object)
49     (save-excursion
50       (set-buffer object)
51       (md5-region (or beg (point-min)) (or end (point-max))))))
52
53 (provide 'md5-dl)
54
55 ;;; md5-dl.el ends here