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.
This commit is contained in:
9
solver/src/algorithms/sha256.zig
Normal file
9
solver/src/algorithms/sha256.zig
Normal file
@@ -0,0 +1,9 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user