Zig
Zig
Compute CRC32 of a File
Calculates the CRC32 of a file's contents and returns the 32-bit CRC as a hex string.Chilkat Zig Downloads
const std = @import("std");
const chilkat = @import("chilkat");
pub fn main(init: std.process.Init) !void {
const alloc = init.arena.allocator();
const zip_crc = try chilkat.ZipCrc.init();
defer zip_crc.deinit();
// Use a relative for absolute path to the file..
const crc = @as(i32, @intCast(zip_crc.fileCrc("qa_data/hamlet.xml")));
const hex_str = try zip_crc.toHex(alloc, @as(u32, @intCast(crc)));
std.debug.print("{s}\n", .{hex_str});
}