2026-07-09 23:42:48 +02:00
|
|
|
const Sha256 = @import("std").crypto.hash.sha2.Sha256;
|
2026-07-08 01:00:39 +02:00
|
|
|
|
2026-07-09 23:42:48 +02:00
|
|
|
pub const hash_len: comptime_int = Sha256.digest_length;
|
2026-06-15 15:23:41 +02:00
|
|
|
|
2026-07-09 23:42:48 +02:00
|
|
|
pub const Implementation = struct {
|
2026-06-15 15:23:41 +02:00
|
|
|
|
2026-07-09 23:42:48 +02:00
|
|
|
hash: *const fn (buffer: []const u8, out: *[hash_len]u8) void,
|
|
|
|
|
};
|
2026-07-03 21:56:17 +02:00
|
|
|
|
2026-07-09 23:42:48 +02:00
|
|
|
pub fn hash(buffer: []const u8, out: *[hash_len]u8) !void {
|
|
|
|
|
Sha256.hash(buffer, out, .{});
|
|
|
|
|
}
|
2026-07-03 21:56:17 +02:00
|
|
|
|
2026-07-09 23:42:48 +02:00
|
|
|
pub const defaultImplementation: Implementation = .{
|
|
|
|
|
.hash = hash,
|
2026-06-15 15:23:41 +02:00
|
|
|
};
|