Skip to content

Commit

Permalink
print sha256sum only on verification error
Browse files Browse the repository at this point in the history
  • Loading branch information
embetrix committed Nov 19, 2024
1 parent bdacab4 commit 19b6c81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bmap-writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@ void BmapWriteImage(const std::string &imageFile, const bmap_t &bmap, const std:
// Compute and verify the checksum
char computedChecksum[CHECKSUM_LENGTH + 1];
computeSHA256(buffer.data(), bytesRead, computedChecksum);
std::cout << "Computed Checksum: " << computedChecksum << std::endl;
std::cout << "Expected Checksum: " << range.checksum << std::endl;
if (strcmp(computedChecksum, range.checksum.c_str()) != 0) {
std::cerr << "Checksum verification failed for range: " << range.range << std::endl;
std::cout << "Computed Checksum: " << computedChecksum << std::endl;
std::cout << "Expected Checksum: " << range.checksum << std::endl;
//std::cout << "Buffer content (hex):" << std::endl;
//printBufferHex(buffer.data(), bytesRead);
close(dev_fd);
Expand Down

0 comments on commit 19b6c81

Please sign in to comment.