Mercurial > emacs
annotate lisp/net/hmac-md5.el @ 107646:dfdf14a6f5a0
Support MS-Windows build and reversed rows in GUI frames; add initial docs.
doc/emacs/mule.texi (International): Mention support of
bidirectional editing.
(Bidirectional Editing): New section.
etc/HELLO: Reorder Arabic and Hebrew into logical order, and
insert RLM before the opening paren, to make the display more
reasonable. Add setting for bidi-display-reordering in the local
variables section.
lisp/files.el: Make bidi-display-reordering safe variable for
boolean values.
src/xdisp (append_glyph): If the glyph row is reversed, prepend the
glyph rather than appending it.
src/makefile.w32-in (OBJ1): Add $(BLD)/bidi.$(O).
($(BLD)/bidi.$(O)): New target.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Mon, 29 Mar 2010 08:26:24 -0400 |
parents | bb307bf2e752 |
children | 8d09094063d0 |
rev | line source |
---|---|
86795 | 1 ;;; hmac-md5.el --- Compute HMAC-MD5. |
2 | |
106815 | 3 ;; Copyright (C) 1999, 2001, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
86795 | 4 |
5 ;; Author: Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp> | |
107390 | 6 ;; Keywords: HMAC, RFC2104, HMAC-MD5, MD5, KEYED-MD5, CRAM-MD5 |
86795 | 7 |
8 ;; This file is part of GNU Emacs. | |
9 | |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
10 ;; GNU Emacs is free software: you can redistribute it and/or modify |
86795 | 11 ;; it under the terms of the GNU General Public License as published by |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
12 ;; the Free Software Foundation, either version 3 of the License, or |
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
13 ;; (at your option) any later version. |
86795 | 14 |
15 ;; GNU Emacs 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 | |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
86795 | 22 |
23 ;;; Commentary: | |
24 | |
25 ;; Test cases from RFC 2202, "Test Cases for HMAC-MD5 and HMAC-SHA-1". | |
26 ;; | |
27 ;; (encode-hex-string (hmac-md5 "Hi There" (make-string 16 ?\x0b))) | |
28 ;; => "9294727a3638bb1c13f48ef8158bfc9d" | |
29 ;; | |
30 ;; (encode-hex-string (hmac-md5 "what do ya want for nothing?" "Jefe")) | |
31 ;; => "750c783e6ab0b503eaa86e310a5db738" | |
32 ;; | |
33 ;; (encode-hex-string (hmac-md5 (make-string 50 ?\xdd) (make-string 16 ?\xaa))) | |
34 ;; => "56be34521d144c88dbb8c733f0e8b3f6" | |
35 ;; | |
36 ;; (encode-hex-string | |
37 ;; (hmac-md5 | |
38 ;; (make-string 50 ?\xcd) | |
39 ;; (decode-hex-string "0102030405060708090a0b0c0d0e0f10111213141516171819"))) | |
40 ;; => "697eaf0aca3a3aea3a75164746ffaa79" | |
41 ;; | |
42 ;; (encode-hex-string | |
43 ;; (hmac-md5 "Test With Truncation" (make-string 16 ?\x0c))) | |
44 ;; => "56461ef2342edc00f9bab995690efd4c" | |
45 ;; | |
46 ;; (encode-hex-string | |
47 ;; (hmac-md5-96 "Test With Truncation" (make-string 16 ?\x0c))) | |
48 ;; => "56461ef2342edc00f9bab995" | |
49 ;; | |
50 ;; (encode-hex-string | |
51 ;; (hmac-md5 | |
52 ;; "Test Using Larger Than Block-Size Key - Hash Key First" | |
53 ;; (make-string 80 ?\xaa))) | |
54 ;; => "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd" | |
55 ;; | |
56 ;; (encode-hex-string | |
57 ;; (hmac-md5 | |
58 ;; "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data" | |
59 ;; (make-string 80 ?\xaa))) | |
60 ;; => "6f630fad67cda0ee1fb1f562db3aa53e" | |
61 | |
62 ;;; Code: | |
63 | |
64 (eval-when-compile (require 'hmac-def)) | |
65 (require 'hex-util) ; (decode-hex-string STRING) | |
66 (require 'md5) ; expects (md5 STRING) | |
67 | |
68 (defun md5-binary (string) | |
69 "Return the MD5 of STRING in binary form." | |
70 (if (condition-case nil | |
71 ;; `md5' of v21 takes 4th arg CODING (and 5th arg NOERROR). | |
72 (md5 "" nil nil 'binary) ; => "d41d8cd98f00b204e9800998ecf8427e" | |
73 (wrong-number-of-arguments nil)) | |
74 (decode-hex-string (md5 string nil nil 'binary)) | |
75 (decode-hex-string (md5 string)))) | |
76 | |
77 (define-hmac-function hmac-md5 md5-binary 64 16) ; => (hmac-md5 TEXT KEY) | |
78 (define-hmac-function hmac-md5-96 md5-binary 64 16 96) | |
79 | |
80 (provide 'hmac-md5) | |
81 | |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87665
diff
changeset
|
82 ;; arch-tag: 0ab3f4f6-3d4b-4167-a9fa-635b7fed7f27 |
86795 | 83 ;;; hmac-md5.el ends here |