Exploring n-values and b-values in secp256k1

19 replies 223 views
0xLaserFull Member
Posts: 107 · Reputation: 641
#1Sep 30, 2025, 06:39 AM
I just found out there are six distinct n-values that match various b-values in secp256k1. It's crazy how they repeat as the b-value goes up. But then I thought, is there a connection between equations like y^2=x^3+7 and y^2=x^3+2? Like, can points on curves with the same p-value and n-value be mapped to each other?
5 Reply Quote Share
coin88Full Member
Posts: 4 · Reputation: 287
#2Sep 30, 2025, 06:59 AM
If there are any points on different curves mapping to each other, we're in trouble. Imagine figuring out one point on a curve and using it on another due to different n-values. You'll be able to crack any key. To see this in action, take a scalar mod n on two curves and compare them.
0 Reply Quote Share
maxsatSenior Member
Posts: 1 · Reputation: 1480
#3Sep 30, 2025, 11:18 AM
This could be tied to modular arithmetic in elliptic curve cryptography. All the operations are done modulo a prime number p, right?
3 Reply Quote Share
Posts: 3 · Reputation: 204
#4Sep 30, 2025, 11:53 AM
Not sure about a direct 1:1 mapping. But I noticed when b=0x0, it creates a simple loop that maps from public key to private key. I haven't found a way to map points from b=0x7 to b=0x0 yet.
3 Reply Quote Share
real_vaultHero Member
Posts: 5 · Reputation: 3335
#5Sep 30, 2025, 05:17 PM
Totally! You can map points on curves with the same number of points. Like b-values 7, 12, 20... they're all isomorphic. But I don't think there's any known connection between curves with different numbers of points.
4 Reply Quote Share
Posts: 10 · Reputation: 185
#6Sep 30, 2025, 06:28 PM
Look into Jacobian coordinates. It's clearer there. You can get the same point using the same X and Y but with a different Z coordinate. By "same point," I mean the points that can project onto an isomorphic plane.
5 Reply Quote Share
5am23Member
Posts: 7 · Reputation: 44
#7Oct 1, 2025, 11:17 AM
For y^2=x^3+d (mod p) with d as a non-zero integer, you see different sets emerge based on group properties.
0 Reply Quote Share
real_vaultHero Member
Posts: 5 · Reputation: 3335
#8Oct 1, 2025, 01:30 PM
In this example, yeah, you can map to another secp256k1 curve. But don't think you can do an invalid curve attack with those mapped points because it leads to the infinity point.
1 Reply Quote Share
5am23Member
Posts: 7 · Reputation: 44
#9Oct 1, 2025, 03:43 PM
What exactly do you mean by p^2?
3 Reply Quote Share
real_vaultHero Member
Posts: 5 · Reputation: 3335
#10Oct 3, 2025, 11:11 PM
Sure, you can crank up the p parameter for an invalid or twist attack, but you still hit the infinity point. If you factor that prime, you'll spot the prime components.
0 Reply Quote Share
5am23Member
Posts: 7 · Reputation: 44
#11Oct 4, 2025, 02:09 AM
Are you sure about that? I keep hitting errors when I try.
1 Reply Quote Share
0xWizardMember
Posts: 8 · Reputation: 224
#12Oct 4, 2025, 03:09 AM
Sorry, I typed that out on my phone. Check this code. It'll help clarify.
0 Reply Quote Share
5am23Member
Posts: 7 · Reputation: 44
#13Oct 4, 2025, 09:55 AM
Got it. But still, I doubt it makes sense to define the cardinality this way, especially matching that of the original curve.
3 Reply Quote Share
Posts: 11 · Reputation: 209
#14Oct 6, 2025, 10:25 AM
Yeah, it looks correct. But trying to change the order number in sagemath seems useless since attacks won’t work, we just get a factor.
3 Reply Quote Share
5am23Member
Posts: 7 · Reputation: 44
#15Oct 6, 2025, 11:36 AM
Anyone up for discussing changing N order in secp256k1?
1 Reply Quote Share
eric_gasFull Member
Posts: 2 · Reputation: 774
#16Oct 6, 2025, 05:19 PM
I think it’s all about mapping coordinates between the original curve and its twist. The private key orders should match.
3 Reply Quote Share
Posts: 38 · Reputation: 19
#17Oct 8, 2025, 12:35 PM
Tried that with p=0xffff...^2, but I just get P combined with regular curves. Everything looks the same structure-wise.
2 Reply Quote Share
Posts: 1111 · Reputation: 35
#18Oct 8, 2025, 01:55 PM
Your code checks out. But I still don't think we can launch curve attacks under these settings. Only mapping should work.
3 Reply Quote Share
Posts: 1111 · Reputation: 35
#19Oct 8, 2025, 06:00 PM
According to Hasse's Theorem, the number of points N on an elliptic curve over a prime field p is bound to be close to p+1, with some leeway. Just having the same number of points doesn't mean there's a direct mapping between all of them.
3 Reply Quote Share
Posts: 1111 · Reputation: 35
#20Oct 8, 2025, 06:26 PM
Fun fact: libsecp256k1 has optimizations that use isomorphic groups to skip calculations. The results may look invalid but they shift onto these isomorphic curves predictably, eventually getting projected back.
3 Reply Quote Share

Related topics