From 4a267c135c553f5eb8f2c99cf5ff53873aad815a Mon Sep 17 00:00:00 2001 From: "Gu://em_" Date: Mon, 20 Jul 2026 00:07:09 +0200 Subject: [PATCH] Changed crypto primitives naming to be more consistent --- src/crypto.zig | 58 +++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/crypto.zig b/src/crypto.zig index 921b0d0..5f6c7ad 100644 --- a/src/crypto.zig +++ b/src/crypto.zig @@ -1,14 +1,14 @@ ///////////////// Imports // -const AES = @import("crypto/aes.zig"); -const ED25519 = @import("crypto/ed25519.zig"); -const HKDF = @import("crypto/hkdf.zig"); -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"); +pub const Aes = @import("crypto/aes.zig"); +pub const Ed25519 = @import("crypto/ed25519.zig"); +pub const Hkdf = @import("crypto/hkdf.zig"); +pub const Hmac = @import("crypto/hmac.zig"); +pub const Sha256 = @import("crypto/sha256.zig"); +pub const Sha512 = @import("crypto/sha512.zig"); +pub const X25519= @import("crypto/x25519.zig"); +pub const Random = @import("crypto/random.zig"); ///////////////// Errors @@ -25,25 +25,25 @@ pub const CryptoError = error { // pub const PartialEngine = struct { - aes_cbc256: ? AES.CBC256.Implementation = null, - ed25519: ? ED25519.Implementation = null, - hkdf: ? HKDF.Implementation = null, - hmac: ? HMAC.Implementation = null, - sha256: ? SHA256.Implementation = null, - sha512: ? SHA512.Implementation = null, + aes_cbc256: ? Aes.CBC256.Implementation = null, + ed25519: ? Ed25519.Implementation = null, + hkdf: ? Hkdf.Implementation = null, + hmac: ? Hmac.Implementation = null, + sha256: ? Sha256.Implementation = null, + sha512: ? Sha512.Implementation = null, x25519: ? X25519.Implementation = null, - random: ? RANDOM.Implementation = null, + random: ? Random.Implementation = null, }; pub const Engine = struct { - aes_cbc256: AES.CBC256.Implementation, - ed25519: ED25519.Implementation, - hkdf: HKDF.Implementation, - hmac: HMAC.Implementation, - sha256: SHA256.Implementation, - sha512: SHA512.Implementation, + aes_cbc256: Aes.CBC256.Implementation, + ed25519: Ed25519.Implementation, + hkdf: Hkdf.Implementation, + hmac: Hmac.Implementation, + sha256: Sha256.Implementation, + sha512: Sha512.Implementation, x25519: X25519.Implementation, - random: RANDOM.Implementation, + random: Random.Implementation, }; @@ -56,14 +56,14 @@ pub const Engine = struct { pub fn resolveEngine(comptime provider: PartialEngine) Engine { return .{ - .aes_cbc256 = provider.aes_cbc256 orelse AES.CBC256.defaultImplementation, - .ed25519 = provider.ed25519 orelse ED25519.defaultImplementation, - .hkdf = provider.hkdf orelse HKDF.defaultImplementation, - .hmac = provider.hmac orelse HMAC.defaultImplementation, - .sha256 = provider.sha256 orelse SHA256.defaultImplementation, - .sha512 = provider.sha512 orelse SHA512.defaultImplementation, + .aes_cbc256 = provider.aes_cbc256 orelse Aes.CBC256.defaultImplementation, + .ed25519 = provider.ed25519 orelse Ed25519.defaultImplementation, + .hkdf = provider.hkdf orelse Hkdf.defaultImplementation, + .hmac = provider.hmac orelse Hmac.defaultImplementation, + .sha256 = provider.sha256 orelse Sha256.defaultImplementation, + .sha512 = provider.sha512 orelse Sha512.defaultImplementation, .x25519 = provider.x25519 orelse X25519.defaultImplementation, - .random = provider.random orelse RANDOM.defaultImplementation, + .random = provider.random orelse Random.defaultImplementation, }; }