Zig
Zig
MD4 Hash a String
See more Encryption Examples
MD4 hash a 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();
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
const crypt = try chilkat.Crypt2.init();
defer crypt.deinit();
const content = "The quick brown fox jumps over the lazy dog";
// The desired output is a hexidecimal string:
crypt.setEncodingMode("hex");
// Set the hash algorithm:
crypt.setHashAlgorithm("md4");
const hash_str = try crypt.hashStringENC(alloc, content);
std.debug.print("{s}\n", .{hash_str});
// The output is:
// 1BEE69A46BA811185C194762ABAEAE90
}