| ... | ... | @@ -24,14 +24,17 @@ pub const EcdsaSecp256k1Sha256 = Ecdsa(crypto.ecc.Secp256k1, crypto.hash.sha2.Sh |
| 24 | 24 | pub const EcdsaSecp256k1Sha256oSha256 = Ecdsa(crypto.ecc.Secp256k1, crypto.hash.composition.Sha256oSha256); |
| 25 | 25 | |
| 26 | 26 | /// Elliptic Curve Digital Signature Algorithm (ECDSA). |
| 27 | | pub fn Ecdsa(comptime Curve: type, comptime Hash: type) type { |
| 28 | | const Prf = switch (Hash) { |
| 27 | pub fn Ecdsa(comptime C: type, comptime H: type) type { |
| 28 | const Prf = switch (H) { |
| 29 | 29 | sha3.Shake128 => sha3.KMac128, |
| 30 | 30 | sha3.Shake256 => sha3.KMac256, |
| 31 | | else => crypto.auth.hmac.Hmac(Hash), |
| 31 | else => crypto.auth.hmac.Hmac(H), |
| 32 | 32 | }; |
| 33 | 33 | |
| 34 | 34 | return struct { |
| 35 | pub const Curve = C; |
| 36 | pub const Hash = H; |
| 37 | |
| 35 | 38 | /// Length (in bytes) of optional random bytes, for non-deterministic signatures. |
| 36 | 39 | pub const noise_length = Curve.scalar.encoded_length; |
| 37 | 40 | |