From a14e2cda6388e4b3eb2098d01208636b0a1165da Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 28 Sep 2026 08:01:16 +0200 Subject: [PATCH] Fix typo by the way: Endormorphism -> Endomorphism --- lib/std/crypto/pcurves/secp256k1.zig | 6 +++--- lib/std/crypto/pcurves/tests/secp256k1.zig | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/std/crypto/pcurves/secp256k1.zig b/lib/std/crypto/pcurves/secp256k1.zig index 78a657076ba0a5a98f5b062a74799f3a1205e15d..37bb8288688adb1d1d0a1a788e1ef15daba3f0c5 100644 --- a/lib/std/crypto/pcurves/secp256k1.zig +++ b/lib/std/crypto/pcurves/secp256k1.zig @@ -35,7 +35,7 @@ pub const Secp256k1 = struct { pub const B = Fe.fromInt(7) catch unreachable; - pub const Endormorphism = struct { + pub const Endomorphism = struct { const lambda = scalarFromInt(37718080363155996902926221483475020450927657555482586988616620542887997980018); const beta = Fe.fromInt(55594575648329892869085402983802832744385952214688224221778511981742606582254) catch unreachable; const b1_neg = scalarFromInt(303414439467246543595250775667605759171); @@ -359,11 +359,11 @@ pub const Secp256k1 = struct { pcs[2 * i] = if (point.is_base) basePointPc[0..9].* else precompute(point, 8); // lambda*P for (&pcs[2 * i + 1], pcs[2 * i]) |*pc_lambda, pc| { - pc_lambda.* = .{ .x = pc.x.mul(Endormorphism.beta), .y = pc.y, .z = pc.z }; + pc_lambda.* = .{ .x = pc.x.mul(Endomorphism.beta), .y = pc.y, .z = pc.z }; } var s48: [48]u8 = undefined; mem.writeInt(u384, &s48, mem.readInt(u256, &k, endian), .little); - const split = Endormorphism.splitScalar(scalar.reduce48(s48, .little), .little) catch unreachable; + const split = Endomorphism.splitScalar(scalar.reduce48(s48, .little), .little) catch unreachable; for ([_][32]u8{ split.r1, split.r2 }, es[2 * i ..][0..2]) |r, *e| { const x = mem.readInt(u256, &r, .little); diff --git a/lib/std/crypto/pcurves/tests/secp256k1.zig b/lib/std/crypto/pcurves/tests/secp256k1.zig index 2de0143a145e667a0e65d11d45ad9d1bde18e30c..b92085f8a81ec411c16ce2c8457309e9e8011182 100644 --- a/lib/std/crypto/pcurves/tests/secp256k1.zig +++ b/lib/std/crypto/pcurves/tests/secp256k1.zig @@ -164,7 +164,7 @@ test "secp256k1 scalar split" { var lambda_s: [32]u8 = undefined; std.mem.writeInt(u256, &lambda_s, lambda, endian); const k = Secp256k1.scalar.random(io, endian); - const split = try Secp256k1.Endormorphism.splitScalar(k, endian); + const split = try Secp256k1.Endomorphism.splitScalar(k, endian); try testing.expectEqual(k, try Secp256k1.scalar.mulAdd(split.r2, lambda_s, split.r1, endian)); for ([_][32]u8{ split.r1, split.r2 }) |r_s| { const r = std.mem.readInt(u256, &r_s, endian); -- 2.54.0