summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/hashes.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-07-14 01:44:35 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-07-14 01:44:35 +0200
commit2dcf7b8f9b9e037901339ddef7d94a6a2bab90db (patch)
tree85755d583e4dda0a21f783fd98301bc8c3914f12 /apt-pkg/contrib/hashes.cc
parent8c4e1f97686c412f88bb57827a84b776626d9980 (diff)
fix sha512 calculation in Hashes::VerifyFiles()
Diffstat (limited to 'apt-pkg/contrib/hashes.cc')
-rw-r--r--apt-pkg/contrib/hashes.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc
index d217747df..4407574fa 100644
--- a/apt-pkg/contrib/hashes.cc
+++ b/apt-pkg/contrib/hashes.cc
@@ -53,31 +53,30 @@ HashString::HashString(string StringedHash) /*{{{*/
/*}}}*/
bool HashString::VerifyFile(string filename) const /*{{{*/
{
- FileFd fd;
- MD5Summation MD5;
- SHA1Summation SHA1;
- SHA256Summation SHA256;
- SHA256Summation SHA512;
string fileHash;
FileFd Fd(filename, FileFd::ReadOnly);
- if(Type == "MD5Sum")
+ if(Type == "MD5Sum")
{
+ MD5Summation MD5;
MD5.AddFD(Fd.Fd(), Fd.Size());
fileHash = (string)MD5.Result();
- }
+ }
else if (Type == "SHA1")
{
+ SHA1Summation SHA1;
SHA1.AddFD(Fd.Fd(), Fd.Size());
fileHash = (string)SHA1.Result();
- }
- else if (Type == "SHA256")
+ }
+ else if (Type == "SHA256")
{
+ SHA256Summation SHA256;
SHA256.AddFD(Fd.Fd(), Fd.Size());
fileHash = (string)SHA256.Result();
}
- else if (Type == "SHA512")
+ else if (Type == "SHA512")
{
+ SHA512Summation SHA512;
SHA512.AddFD(Fd.Fd(), Fd.Size());
fileHash = (string)SHA512.Result();
}