merge hmac package
[elisp/flim.git] / md5.el
1 ;;; md5.el --- MD5 Message Digest Algorithm.
2
3 ;; Copyright (C) 1999 Shuhei KOBAYASHI
4
5 ;; Author: Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
6 ;; Keywords: MD5, RFC 1321
7
8 ;; This program is free software; you can redistribute it and/or
9 ;; modify it under the terms of the GNU General Public License as
10 ;; published by the Free Software Foundation; either version 2, or
11 ;; (at your option) any later version.
12
13 ;; This program 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 this program; 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 ;; Examples from RFC 1321.
26 ;;
27 ;; (md5 "")
28 ;; => d41d8cd98f00b204e9800998ecf8427e
29 ;;
30 ;; (md5 "a")
31 ;; => 0cc175b9c0f1b6a831c399e269772661
32 ;;
33 ;; (md5 "abc")
34 ;; => 900150983cd24fb0d6963f7d28e17f72
35 ;;
36 ;; (md5 "message digest")
37 ;; => f96b697d7cb7938d525a2f31aaf161d0
38 ;;
39 ;; (md5 "abcdefghijklmnopqrstuvwxyz")
40 ;; => c3fcd3d76192e4007dfb496cca67e13b
41 ;;
42 ;; (md5 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
43 ;; => d174ab98d277d9f5a5611c2c9f419d9f
44 ;;
45 ;; (md5 "12345678901234567890123456789012345678901234567890123456789012345678901234567890")
46 ;; => 57edf4a22be3c955ac49da2e2107b67a
47
48 ;;; Code:
49
50 (cond
51  ((and (fboundp 'md5)
52        (subrp (symbol-function 'md5)))
53   ;; recent XEmacs has `md5' as a built-in function.
54   ;; (and 'md5 is already provided.)
55   )
56  ((and (fboundp 'dynamic-link)
57        (file-exists-p (expand-file-name "md5.so" exec-directory)))
58   ;; Emacs with DL patch.
59   (require 'md5 "md5-dl"))
60  (t
61   (require 'md5 "md5-el")))
62
63 ;;; md5.el ends here.