| ... | @@ -35,7 +35,7 @@ pub const Secp256k1 = struct { | ... | @@ -35,7 +35,7 @@ pub const Secp256k1 = struct { |
| 35 | | 35 | |
| 36 | pub const B = Fe.fromInt(7) catch unreachable; | 36 | pub const B = Fe.fromInt(7) catch unreachable; |
| 37 | | 37 | |
| 38 | pub const Endormorphism = struct { | 38 | pub const Endomorphism = struct { |
| 39 | const lambda = scalarFromInt(37718080363155996902926221483475020450927657555482586988616620542887997980018); | 39 | const lambda = scalarFromInt(37718080363155996902926221483475020450927657555482586988616620542887997980018); |
| 40 | const beta = Fe.fromInt(55594575648329892869085402983802832744385952214688224221778511981742606582254) catch unreachable; | 40 | const beta = Fe.fromInt(55594575648329892869085402983802832744385952214688224221778511981742606582254) catch unreachable; |
| 41 | const b1_neg = scalarFromInt(303414439467246543595250775667605759171); | 41 | const b1_neg = scalarFromInt(303414439467246543595250775667605759171); |
| ... | @@ -359,11 +359,11 @@ pub const Secp256k1 = struct { | ... | @@ -359,11 +359,11 @@ pub const Secp256k1 = struct { |
| 359 | pcs[2 * i] = if (point.is_base) basePointPc[0..9].* else precompute(point, 8); | 359 | pcs[2 * i] = if (point.is_base) basePointPc[0..9].* else precompute(point, 8); |
| 360 | // lambda*P | 360 | // lambda*P |
| 361 | for (&pcs[2 * i + 1], pcs[2 * i]) |*pc_lambda, pc| { | 361 | for (&pcs[2 * i + 1], pcs[2 * i]) |*pc_lambda, pc| { |
| 362 | pc_lambda.* = .{ .x = pc.x.mul(Endormorphism.beta), .y = pc.y, .z = pc.z }; | 362 | pc_lambda.* = .{ .x = pc.x.mul(Endomorphism.beta), .y = pc.y, .z = pc.z }; |
| 363 | } | 363 | } |
| 364 | var s48: [48]u8 = undefined; | 364 | var s48: [48]u8 = undefined; |
| 365 | mem.writeInt(u384, &s48, mem.readInt(u256, &k, endian), .little); | 365 | mem.writeInt(u384, &s48, mem.readInt(u256, &k, endian), .little); |
| 366 | const split = Endormorphism.splitScalar(scalar.reduce48(s48, .little), .little) catch unreachable; | 366 | const split = Endomorphism.splitScalar(scalar.reduce48(s48, .little), .little) catch unreachable; |
| 367 | | 367 | |
| 368 | for ([_][32]u8{ split.r1, split.r2 }, es[2 * i ..][0..2]) |r, *e| { | 368 | for ([_][32]u8{ split.r1, split.r2 }, es[2 * i ..][0..2]) |r, *e| { |
| 369 | const x = mem.readInt(u256, &r, .little); | 369 | const x = mem.readInt(u256, &r, .little); |