Added the random crypto module with its default implementation, implemented the Ed25519 keys generation function

This commit is contained in:
Gu://em_ 2026-07-04 11:08:11 +02:00
parent 1216dc2282
commit ff60995aaa
3 changed files with 44 additions and 26 deletions

View file

@ -12,6 +12,7 @@ const HMAC = @import("crypto/hmac.zig");
const SHA256 = @import("crypto/sha256.zig");
const SHA512 = @import("crypto/sha512.zig");
const X25519= @import("crypto/x25519.zig");
const RANDOM = @import("crypto/random.zig");
///////////////// Structs
@ -25,6 +26,7 @@ pub const PartialEngine = struct {
sha256: ? SHA256.Implementation = null,
sha512: ? SHA512.Implementation = null,
x25519: ? X25519.Implementation = null,
random: ? RANDOM.Implementation = null,
};
pub const Engine = struct {
@ -35,6 +37,7 @@ pub const Engine = struct {
sha256: SHA256.Implementation,
sha512: SHA512.Implementation,
x25519: X25519.Implementation,
random: RANDOM.Implementation,
};
@ -53,6 +56,7 @@ pub fn resolveEngine(comptime provider: PartialEngine) Engine {
.sha256 = provider.sha256 orelse SHA256.DefaultImplementation,
.sha512 = provider.sha512 orelse SHA512.DefaultImplementation,
.x25519 = provider.x25519 orelse X25519.DefaultImplementation,
.random = provider.random orelse RANDOM.DefaultImplementation,
};
}