authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-03-20 12:02:39 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-03-20 12:02:39 -07:00
log8d81d0bdb157997e6f4e1a8a556fe6e82941cbe8
tree291dfc7dd524bd649a18625c7e22080f47c41006
parent53b62b9f0adf6c726e23fcce530aeb333b232467

log hashes when they dont match


1 files changed, 5 insertions(+), 1 deletions(-)

src/util/funcs.zig+5-1
...@@ -270,7 +270,11 @@ pub fn validate_hash(input: []const u8, file_path: []const u8) !bool {...@@ -270,7 +270,11 @@ pub fn validate_hash(input: []const u8, file_path: []const u8) !bool {
270 .sha256 => try do_hash(std.crypto.hash.sha2.Sha256, data),270 .sha256 => try do_hash(std.crypto.hash.sha2.Sha256, data),
271 .sha512 => try do_hash(std.crypto.hash.sha2.Sha512, data),271 .sha512 => try do_hash(std.crypto.hash.sha2.Sha512, data),
272 };272 };
273 return std.mem.eql(u8, expected, actual);273 const result = std.mem.eql(u8, expected, actual);
274 if (!result) {
275 std.log.info("expected: {s}, actual: {s}", .{expected, actual});
276 }
277 return result;
274}278}
275279
276pub fn do_hash(comptime algo: type, data: []const u8) ![]const u8 {280pub fn do_hash(comptime algo: type, data: []const u8) ![]const u8 {