diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2020-01-07 20:36:53 +0100 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2020-01-14 13:10:36 +0100 |
commit | 79de3008ebfc6b4a5dd32e9de1d19788da0b885d (patch) | |
tree | 277129f384746a11c25a08d1b0b879c41fe207ad /apt-pkg/contrib/hashes.h | |
parent | b350560e34a369ef7610f9fceeffb00660209390 (diff) |
Convert users of {MD5,SHA1,SHA256,SHA512}Summation to use Hashes
This makes use of the a function GetHashString() that returns
the specific hash string. We also need to implement another overload
of Add() for signed chars with sizes, so the existing users do not
require reinterpret_cast everywhere.
Diffstat (limited to 'apt-pkg/contrib/hashes.h')
-rw-r--r-- | apt-pkg/contrib/hashes.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h index 14100e13b..07ccc6900 100644 --- a/apt-pkg/contrib/hashes.h +++ b/apt-pkg/contrib/hashes.h @@ -184,6 +184,10 @@ class Hashes bool Add(const unsigned char * const Data, unsigned long long const Size) APT_NONNULL(2); inline bool Add(const char * const Data) APT_NONNULL(2) {return Add(reinterpret_cast<unsigned char const *>(Data),strlen(Data));}; + inline bool Add(const char *const Data, unsigned long long const Size) APT_NONNULL(2) + { + return Add(reinterpret_cast<unsigned char const *>(Data), Size); + }; inline bool Add(const unsigned char * const Beg,const unsigned char * const End) APT_NONNULL(2,3) {return Add(Beg,End-Beg);}; @@ -194,6 +198,9 @@ class Hashes HashStringList GetHashStringList(); + /** Get a specific hash. It is an error to use a hash that was not hashes */ + HashString GetHashString(SupportedHashes hash); + /** create a Hashes object to calculate all supported hashes * * If ALL is too much, you can limit which Hashes are calculated |