Changed crypto primitives naming to be more consistent

This commit is contained in:
Gu://em_ 2026-07-20 00:07:09 +02:00
parent e594fab52f
commit 4a267c135c

View file

@ -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,
};
}