From b18436dfad20428e661197a71f4dc12143f4dac0 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Wed, 15 Jul 2026 16:48:50 -0700 Subject: [PATCH] std.crypto.sign.ecdsa: pub Curve and Hash parameters --- lib/std/crypto/ecdsa.zig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/std/crypto/ecdsa.zig b/lib/std/crypto/ecdsa.zig index 8977851b44ea04596ff686ec46fa576aa9b9693f..77e0349341168fd3d6e0b68979d95cf45753bc4f 100644 --- a/lib/std/crypto/ecdsa.zig +++ b/lib/std/crypto/ecdsa.zig @@ -24,14 +24,17 @@ pub const EcdsaSecp256k1Sha256 = Ecdsa(crypto.ecc.Secp256k1, crypto.hash.sha2.Sh pub const EcdsaSecp256k1Sha256oSha256 = Ecdsa(crypto.ecc.Secp256k1, crypto.hash.composition.Sha256oSha256); /// Elliptic Curve Digital Signature Algorithm (ECDSA). -pub fn Ecdsa(comptime Curve: type, comptime Hash: type) type { - const Prf = switch (Hash) { +pub fn Ecdsa(comptime C: type, comptime H: type) type { + const Prf = switch (H) { sha3.Shake128 => sha3.KMac128, sha3.Shake256 => sha3.KMac256, - else => crypto.auth.hmac.Hmac(Hash), + else => crypto.auth.hmac.Hmac(H), }; return struct { + pub const Curve = C; + pub const Hash = H; + /// Length (in bytes) of optional random bytes, for non-deterministic signatures. pub const noise_length = Curve.scalar.encoded_length; -- 2.54.0