reticulum-zero/src/crypto/sha512.zig

20 lines
444 B
Zig
Raw Normal View History

const Sha512 = @import("std").crypto.sha2.Sha512;
pub const hash_len: comptime_int = Sha512.digest_length;
pub const Implementation = struct {
hash: *const fn (buffer: []const u8, out: []u8) void,
};
fn hash(buffer: []const u8, out: []u8) !void {
if (out.len < hash_len) {
return error.BufferTooShort;
}
Sha512.hash(buffer, out, .{});
}
pub const defaultImplementation: Implementation = .{
.hash = hash,
};