SHA1 digest - chung-leong/zigar GitHub Wiki
This example demonstrates how to use the following Zig code to calculate the SHA-1 digest of a file:
const std = @import("std");
pub fn sha1(bytes: []const u8) [std.crypto.hash.Sha1.digest_length * 2]u8 {
var digest: [std.crypto.hash.Sha1.digest_length]u8 = undefined;
std.crypto.hash.Sha1.hash(bytes, &digest, .{});
return std.fmt.bytesToHex(digest, .lower);
}
Choose the ecosystem you're interested in: