Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

tvTry

ecdsa.tvTry
fn tvTry(comptime Scheme: type, vector: TestVector) !void

File

lib/std/crypto/ecdsa.zig:1621

Code

fn tvTry(comptime Scheme: type, vector: TestVector) !void {
    var key_sec1_: [Scheme.PublicKey.uncompressed_sec1_encoded_length]u8 = undefined;
    const key_sec1 = try fmt.hexToBytes(&key_sec1_, vector.key);
    const pk = try Scheme.PublicKey.fromSec1(key_sec1);
    var msg_: [40]u8 = undefined;
    const msg = try fmt.hexToBytes(&msg_, vector.msg);
    var sig_der_: [Scheme.Signature.der_encoded_length_max]u8 = undefined;
    const sig_der = try fmt.hexToBytes(&sig_der_, vector.sig);
    const sig = try Scheme.Signature.fromDer(sig_der);
    try sig.verify(msg, pk);
}