| ... | @@ -207,11 +207,11 @@ pub const HashFn = enum { | ... | @@ -207,11 +207,11 @@ pub const HashFn = enum { |
| 207 | sha512, | 207 | sha512, |
| 208 | }; | 208 | }; |
| 209 | | 209 | |
| 210 | pub fn validate_hash(input: string, file_path: string) !bool { | 210 | pub fn validate_hash(alloc: *std.mem.Allocator, input: string, file_path: string) !bool { |
| 211 | const hash = parse_split(HashFn, "-").do(input) catch return false; | 211 | const hash = parse_split(HashFn, "-").do(input) catch return false; |
| 212 | const file = try std.fs.cwd().openFile(file_path, .{}); | 212 | const file = try std.fs.cwd().openFile(file_path, .{}); |
| 213 | defer file.close(); | 213 | defer file.close(); |
| 214 | const data = try file.reader().readAllAlloc(gpa, gb); | 214 | const data = try file.reader().readAllAlloc(alloc, gb); |
| 215 | const expected = hash.string; | 215 | const expected = hash.string; |
| 216 | const actual = switch (hash.id) { | 216 | const actual = switch (hash.id) { |
| 217 | .blake3 => try do_hash(std.crypto.hash.Blake3, data), | 217 | .blake3 => try do_hash(std.crypto.hash.Blake3, data), |