- "SHA512", "SHA256", "SHA1", "MD5Sum", NULL
+ "SHA512", "SHA256", "SHA1", "MD5Sum", "Checksum-FileSize", NULL
return false;
std::string const forcedType = _config->Find("Acquire::ForceHash", "");
if (forcedType.empty() == true)
return false;
std::string const forcedType = _config->Find("Acquire::ForceHash", "");
if (forcedType.empty() == true)
// Hashes::Add* - Add the contents of data or FD /*{{{*/
bool Hashes::Add(const unsigned char * const Data,unsigned long long const Size, unsigned int const Hashes)
{
bool Res = true;
// Hashes::Add* - Add the contents of data or FD /*{{{*/
bool Hashes::Add(const unsigned char * const Data,unsigned long long const Size, unsigned int const Hashes)
{
bool Res = true;
if ((Hashes & MD5SUM) == MD5SUM)
Res &= MD5.Add(Data, Size);
if ((Hashes & SHA1SUM) == SHA1SUM)
if ((Hashes & MD5SUM) == MD5SUM)
Res &= MD5.Add(Data, Size);
if ((Hashes & SHA1SUM) == SHA1SUM)
Res &= SHA256.Add(Data, Size);
if ((Hashes & SHA512SUM) == SHA512SUM)
Res &= SHA512.Add(Data, Size);
Res &= SHA256.Add(Data, Size);
if ((Hashes & SHA512SUM) == SHA512SUM)
Res &= SHA512.Add(Data, Size);
hashes.push_back(HashString("MD5Sum", MD5.Result().Value()));
hashes.push_back(HashString("SHA1", SHA1.Result().Value()));
hashes.push_back(HashString("SHA256", SHA256.Result().Value()));
hashes.push_back(HashString("SHA512", SHA512.Result().Value()));
hashes.push_back(HashString("MD5Sum", MD5.Result().Value()));
hashes.push_back(HashString("SHA1", SHA1.Result().Value()));
hashes.push_back(HashString("SHA256", SHA256.Result().Value()));
hashes.push_back(HashString("SHA512", SHA512.Result().Value()));
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
+ std::string SizeStr;
+ strprintf(SizeStr, "%llu", d->FileSize);
+ hashes.push_back(HashString("Checksum-FileSize", SizeStr));
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- #pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
-#endif
-Hashes::Hashes() {}
-Hashes::~Hashes() {}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_PUSH
+Hashes::Hashes() { d = new PrivateHashes(); }
+Hashes::~Hashes() { delete d; }
+APT_IGNORE_DEPRECATED_POP