[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
30/295: daemon: Recognize SHA3 and BLAKE2s.
From: |
guix-commits |
Subject: |
30/295: daemon: Recognize SHA3 and BLAKE2s. |
Date: |
Mon, 27 Jul 2020 06:25:09 -0400 (EDT) |
dannym pushed a commit to branch wip-desktop
in repository guix.
commit 8e6c1415d87272c0221ce328715fc0dd1dd3e032
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Tue Jun 23 16:33:38 2020 +0200
daemon: Recognize SHA3 and BLAKE2s.
* nix/libutil/hash.hh (HashType): Add htSHA3_256, htSHA3_512, and
htBLAKE2s_256.
* nix/libutil/hash.cc (parseHashType, printHashType): Recognize them.
* tests/store.scm ("add-to-store"): Test these algorithms.
---
nix/libutil/hash.cc | 6 ++++++
nix/libutil/hash.hh | 5 ++++-
tests/store.scm | 4 ++--
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/nix/libutil/hash.cc b/nix/libutil/hash.cc
index 20d2e4b..7853acd 100644
--- a/nix/libutil/hash.cc
+++ b/nix/libutil/hash.cc
@@ -321,6 +321,9 @@ HashType parseHashType(const string & s)
else if (s == "sha1") return htSHA1;
else if (s == "sha256") return htSHA256;
else if (s == "sha512") return htSHA512;
+ else if (s == "sha3-256") return htSHA3_256;
+ else if (s == "sha3-512") return htSHA3_512;
+ else if (s == "blake2s-256") return htBLAKE2s_256;
else return htUnknown;
}
@@ -331,6 +334,9 @@ string printHashType(HashType ht)
else if (ht == htSHA1) return "sha1";
else if (ht == htSHA256) return "sha256";
else if (ht == htSHA512) return "sha512";
+ else if (ht == htSHA3_256) return "sha3-256";
+ else if (ht == htSHA3_512) return "sha3-512";
+ else if (ht == htBLAKE2s_256) return "blake2s-256";
else throw Error("cannot print unknown hash type");
}
diff --git a/nix/libutil/hash.hh b/nix/libutil/hash.hh
index 7357a34..ac58651 100644
--- a/nix/libutil/hash.hh
+++ b/nix/libutil/hash.hh
@@ -16,7 +16,10 @@ typedef enum {
htMD5 = GCRY_MD_MD5,
htSHA1 = GCRY_MD_SHA1,
htSHA256 = GCRY_MD_SHA256,
- htSHA512 = GCRY_MD_SHA512
+ htSHA512 = GCRY_MD_SHA512,
+ htSHA3_256 = GCRY_MD_SHA3_256,
+ htSHA3_512 = GCRY_MD_SHA3_512,
+ htBLAKE2s_256 = GCRY_MD_BLAKE2S_256
} HashType;
struct Hash
diff --git a/tests/store.scm b/tests/store.scm
index 06f7939..ee3e01f 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -116,7 +116,7 @@
(list (stat:uid s) (stat:perms s))))
(test-equal "add-to-store"
- '("sha1" "sha256" "sha512")
+ '("sha1" "sha256" "sha512" "sha3-256" "sha3-512" "blake2s-256")
(let* ((file (search-path %load-path "guix.scm"))
(content (call-with-input-file file get-bytevector-all)))
(map (lambda (hash-algo)
@@ -125,7 +125,7 @@
(bytevector=? (call-with-input-file file get-bytevector-all)
content)
hash-algo)))
- '("sha1" "sha256" "sha512"))))
+ '("sha1" "sha256" "sha512" "sha3-256" "sha3-512" "blake2s-256"))))
(test-equal "add-data-to-store"
#vu8(1 2 3 4 5)
- 06/295: gnu: opusfile: Update to 0.12., (continued)
- 06/295: gnu: opusfile: Update to 0.12., guix-commits, 2020/07/27
- 20/295: gnu: libcyaml: Remove unused input., guix-commits, 2020/07/27
- 11/295: gnu: libconfuse: Do not build static libraries., guix-commits, 2020/07/27
- 18/295: gnu: libzip: Update to 1.7.1., guix-commits, 2020/07/27
- 10/295: gnu: libconfuse: Update to 3.3., guix-commits, 2020/07/27
- 26/295: gnu: Add autofs., guix-commits, 2020/07/27
- 34/295: gnu: dropbear: Update to 2020.80 [fix for CVE-2018-20685]., guix-commits, 2020/07/27
- 24/295: gnu: python-setproctitle: Fix build., guix-commits, 2020/07/27
- 08/295: gnu: feh: Update to 3.4.1., guix-commits, 2020/07/27
- 16/295: gnu: exempi: Update to 2.5.2., guix-commits, 2020/07/27
- 30/295: daemon: Recognize SHA3 and BLAKE2s.,
guix-commits <=
- 27/295: bash completion: Complete 'guix environment' properly., guix-commits, 2020/07/27
- 35/295: gnu: r-dexseq: Update to 1.34.1., guix-commits, 2020/07/27
- 40/295: gnu: r-ggpubr: Update to 0.4.0., guix-commits, 2020/07/27
- 36/295: gnu: r-biocviews: Update to 1.56.1., guix-commits, 2020/07/27
- 38/295: gnu: r-jsonlite: Update to 1.7.0., guix-commits, 2020/07/27
- 37/295: gnu: r-scater: Update to 1.16.2., guix-commits, 2020/07/27
- 42/295: gnu: r-sjlabelled: Update to 1.1.6., guix-commits, 2020/07/27
- 45/295: gnu: r-rcppparallel: Update to 5.0.2., guix-commits, 2020/07/27
- 47/295: gnu: r-rgdal: Update to 1.5-12., guix-commits, 2020/07/27
- 48/295: gnu: r-directlabels: Update to 2020.6.17., guix-commits, 2020/07/27