Files
impost/solver/src/algorithms/sha256.zig
Zoe e16383e9b9 Implement algorithm switching
This commit implements every algorithm I have played with so far. It also allows for you to switch which algorithm you want to use at runtime.
2025-11-25 18:09:17 +00:00

10 lines
317 B
Zig

const std = @import("std");
const Allocator = std.mem.Allocator;
pub fn hash(allocator: Allocator, data: []const u8) ![]u8 {
const output_hash = try allocator.alloc(u8, std.crypto.hash.sha2.Sha256.digest_length);
std.crypto.hash.sha2.Sha256.hash(data, @ptrCast(output_hash), .{});
return output_hash;
}