aboutsummaryrefslogtreecommitdiff
path: root/tests/hash.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-03-08 11:47:28 +0100
committerLudovic Courtès <ludo@gnu.org>2018-03-08 11:56:20 +0100
commit33286075b9c2ecd27607b5674c68909dd528473a (patch)
treebd438924700e215fe9cba3d1168dba6e6dfad597 /tests/hash.scm
parent3aab8851442713f6ad748ffebb055c5e9eae1bd4 (diff)
downloadguix-33286075b9c2ecd27607b5674c68909dd528473a.tar
guix-33286075b9c2ecd27607b5674c68909dd528473a.tar.gz
hash: Add 'sha1'.
* guix/hash.scm (GCRY_MD_SHA1): New macro. (bytevector-hash): New procedure. (sha256): Express in terms of 'bytevector-hash'. (sha1): New procedure. * tests/hash.scm ("sha1, empty", "sha1, hello"): New tests.
Diffstat (limited to 'tests/hash.scm')
-rw-r--r--tests/hash.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/hash.scm b/tests/hash.scm
index b4cf2b61d6..da87616eec 100644
--- a/tests/hash.scm
+++ b/tests/hash.scm
@@ -40,6 +40,14 @@
(test-begin "hash")
+(test-equal "sha1, empty"
+ (base16-string->bytevector "da39a3ee5e6b4b0d3255bfef95601890afd80709")
+ (sha1 #vu8()))
+
+(test-equal "sha1, hello"
+ (base16-string->bytevector "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed")
+ (sha1 (string->utf8 "hello world")))
+
(test-equal "sha256, empty"
%empty-sha256
(sha256 #vu8()))