17 lines
430 B
Zig
17 lines
430 B
Zig
pub const Implementation = struct {
|
|
|
|
hash_length: comptime_int,
|
|
|
|
hash: *const fn (buffer: []const u8, out: *[Implementation.hash_length]u8) void,
|
|
};
|
|
|
|
pub const defaultImplementation = struct {
|
|
|
|
const Sha256 = @import("std").crypto.hash.sha2.Sha256;
|
|
|
|
pub const hash_len = Sha256.digest_length;
|
|
|
|
pub fn hash(buffer: []const u8, out: *[hash_len]u8) !void {
|
|
Sha256.hash(buffer, out, .{});
|
|
}
|
|
};
|