1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:17:45 +00:00

checksum: Use :hex-dump to format digest value

This commit is contained in:
Michel Hermier 2022-01-04 03:23:58 +01:00 committed by Ali Mohammad Pur
parent 23fe07a148
commit 25251f1b05

View file

@ -65,12 +65,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
while (!file->eof() && !file->has_error())
hash.update(file->read(PAGE_SIZE));
auto digest = hash.digest();
auto digest_data = digest.immutable_data();
StringBuilder builder;
for (size_t i = 0; i < hash.digest_size(); ++i)
builder.appendff("{:02x}", digest_data[i]);
auto hash_sum_hex = builder.build();
outln("{} {}", hash_sum_hex, path);
outln("{:hex-dump} {}", ReadonlyBytes(digest.immutable_data(), digest.data_length()), path);
}
return has_error ? 1 : 0;
}