- // Hash the file
- char *Start = Buffer;
- char *BlkEnd = Buffer + FSize;
-
- Hashes DscHashes;
- if (FSize == (unsigned long long) St.st_size)
- {
- if (DoMD5 == true)
- DscHashes.MD5.Add((unsigned char *)Start,BlkEnd - Start);
- if (DoSHA1 == true)
- DscHashes.SHA1.Add((unsigned char *)Start,BlkEnd - Start);
- if (DoSHA256 == true)
- DscHashes.SHA256.Add((unsigned char *)Start,BlkEnd - Start);
- if (DoSHA512 == true)
- DscHashes.SHA512.Add((unsigned char *)Start,BlkEnd - Start);
- }
- else
- {
- FileFd DscFile(FileName, FileFd::ReadOnly);
- DscHashes.AddFD(DscFile, St.st_size, DoMD5, DoSHA1, DoSHA256, DoSHA512);
- }