reticulum-zero/src/crypto/sha512.zig

19 lines
432 B
Zig
Raw Normal View History

pub const Implementation = struct {
hash: *const fn (buffer: []const u8, out: []u8) void,
};
pub const defaultImplementation = struct {
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, .{});
}
};