Sample code for 30+ languages & platforms
Zig

Example: Crypt2.CrcBd method

Demonstrates how to call the CrcBd method.

Chilkat Zig Downloads

Zig
const std = @import("std");
const chilkat = @import("chilkat");

pub fn main() !void {
    const crypt = try chilkat.Crypt2.init();
    defer crypt.deinit();

    const bd = try chilkat.BinData.init();
    defer bd.deinit();
    bd.appendString("123456789", "us-ascii") catch {};

    const crc32 = crypt.crcBd("crc-32", bd);
    // The decimal value is 3421780262 (converted to hex is 0xCBF43926)
    std.debug.print("{d}\n", .{crc32});

    const crc8 = crypt.crcBd("crc8", bd);
    std.debug.print("{d}\n", .{crc8});
}