2026-06-15 15:23:41 +02:00
|
|
|
pub const Implementation = struct {
|
|
|
|
|
|
2026-07-03 21:56:17 +02:00
|
|
|
hash: *const fn (buffer: []const u8, out: []u8) void,
|
2026-06-15 15:23:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
pub const defaultImplementation = struct {
|
|
|
|
|
|
2026-07-03 21:56:17 +02:00
|
|
|
const Sha512 = @import("std").crypto.sha2.Sha512;
|
|
|
|
|
|
|
|
|
|
const HASH_LEN = 64; // In bytes
|
|
|
|
|
|
|
|
|
|
pub fn hash(buffer: []const u8, out: []u8) !void {
|
|
|
|
|
if (out.len < HASH_LEN) {
|
|
|
|
|
return error.BufferTooShort;
|
|
|
|
|
}
|
|
|
|
|
Sha512.hash(buffer, out, .{});
|
|
|
|
|
}
|
2026-06-15 15:23:41 +02:00
|
|
|
};
|