]> git.eshelyaron.com Git - emacs.git/commitdiff
* test/src/fns-tests.el (test-secure-hash): Test getrandom format.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 29 Jun 2020 16:54:45 +0000 (09:54 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 29 Jun 2020 16:55:33 +0000 (09:55 -0700)
test/src/fns-tests.el

index b65543a64b50502ba8babe8112236876e2c8321a..f1faf58659a3554d7d44b416dbccd11ddc741674 100644 (file)
   (should (equal (secure-hash 'sha512 "foobar")
                  (concat "0a50261ebd1a390fed2bf326f2673c145582a6342d5"
                          "23204973d0219337f81616a8069b012587cf5635f69"
-                         "25f1b56c360230c19b273500ee013e030601bf2425"))))
-
-(provide 'fns-tests)
+                         "25f1b56c360230c19b273500ee013e030601bf2425")))
+  ;; Test that a call to getrandom returns the right format.
+  ;; This does not test randomness; it's merely a format check.
+  (should (string-match "\\`[0-9a-f]\\{128\\}\\'"
+                        (secure-hash 'sha512 'iv-auto 100))))