#pragma once #include #include "types.hh" #include "serialise.hh" namespace nix { extern const string base32Chars; typedef enum { htUnknown = 0, htMD5 = GCRY_MD_MD5, htSHA1 = GCRY_MD_SHA1, htSHA256 = GCRY_MD_SHA256, 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 { static const unsigned int maxHashSize = 64; unsigned int hashSize; unsigned char hash[maxHashSize]; HashType type; /* Create an unusable hash object. */ Hash(); /* Create a zero-filled hash object. */ Hash(HashType type); /* Check whether two hash are equal. */ bool operator == (const Hash & h2) const; /* Check whether two hash are not equal. */ bool operator != (const Hash & h2) const; /* For sorting. */ bool operator < (const Hash & h) const; }; /* Convert a hash to a hexadecimal representation. */ string printHash(const Ha
aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2020 Google LLC
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2022 Oleg Pykhalov <go.wigust@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix 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 Guix 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 PU