reticulum-zero/src/crypto/sha256.zig

19 lines
437 B
Zig
Raw Normal View History

pub const Implementation = struct {
hash: *const fn (buffer: []const u8, out: []u8) void,
};
pub const defaultImplementation = struct {
const Sha256 = @import("std").crypto.hash.sha2.Sha256;
const HASH_LEN = 32; // In bytes
pub fn hash(buffer: []const u8, out: []u8) !void {
if (out.len < HASH_LEN) {
return error.BufferTooShort;
}
Sha256.hash(buffer, out, .{});
}
};