summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-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();
}