emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master f49f8c1: Turn on lexical-binding in md4.el


From: Mark Oteiza
Subject: [Emacs-diffs] master f49f8c1: Turn on lexical-binding in md4.el
Date: Tue, 3 Jan 2017 23:35:27 +0000 (UTC)

branch: master
commit f49f8c1454e19123572a071bf582271c70d28f01
Author: Mark Oteiza <address@hidden>
Commit: Mark Oteiza <address@hidden>

    Turn on lexical-binding in md4.el
    
    * lisp/md4.el: Turn on lexical-binding.
    * test/lisp/md4-tests.el: New file.
---
 lisp/md4.el            |    2 +-
 test/lisp/md4-tests.el |   61 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 1 deletion(-)

diff --git a/lisp/md4.el b/lisp/md4.el
index 79a76c4..23d00ab 100644
--- a/lisp/md4.el
+++ b/lisp/md4.el
@@ -1,4 +1,4 @@
-;;; md4.el --- MD4 Message Digest Algorithm.
+;;; md4.el --- MD4 Message Digest Algorithm. -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2001, 2004, 2007-2017 Free Software Foundation, Inc.
 
diff --git a/test/lisp/md4-tests.el b/test/lisp/md4-tests.el
new file mode 100644
index 0000000..169ed83
--- /dev/null
+++ b/test/lisp/md4-tests.el
@@ -0,0 +1,61 @@
+;;; md4-tests.el --- tests for md4.el -*- lexical-binding: t -*-
+
+;; Copyright (C) 2017  Free Software Foundation, Inc.
+
+;; Author: Mark Oteiza <address@hidden>
+;; Maintainer: address@hidden
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs 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 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'ert)
+(require 'md4)
+
+(defun md4-tests-digest->hex (str)
+  "Print digest STR in hexadecimal."
+  (mapconcat (lambda (x) (format "%02x" x)) str ""))
+
+(ert-deftest md4-test-rfc1320 ()
+  "Verify the test suite results in RFC 1320.
+See <https://tools.ietf.org/html/rfc1320>."
+  (should
+   (equal (md4-tests-digest->hex (md4 "" 0))
+          "31d6cfe0d16ae931b73c59d7e0c089c0"))
+  (should
+   (equal (md4-tests-digest->hex (md4 "a" 1))
+          "bde52cb31de33e46245e05fbdbd6fb24"))
+  (should
+   (equal (md4-tests-digest->hex (md4 "abc" 3))
+          "a448017aaf21d8525fc10ae87aa6729d"))
+  (should
+   (equal (md4-tests-digest->hex (md4 "message digest" 14))
+          "d9130a8164549fe818874806e1c7014b"))
+  (should
+   (equal (md4-tests-digest->hex (md4 "abcdefghijklmnopqrstuvwxyz" 26))
+          "d79e1c308aa5bbcdeea8ed63df412da9"))
+  (should
+   (equal (md4-tests-digest->hex
+           (md4 
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" 62))
+          "043f8582f241db351ce627e153e7f0e4"))
+  (should
+   (equal (md4-tests-digest->hex
+           (md4 
"12345678901234567890123456789012345678901234567890123456789012345678901234567890"
 80))
+          "e33b4ddc9c38f2199c3e7b164fcc0536")))
+
+;;; md4-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]