Understanding ECDSA

(avidthinker.github.io)

67 points by avidthinker 7 hours ago

13 comments

This article is basically an exercise in understanding ECDSA (Elliptic Curve Digital Signature Algorithm) from scratch. All I assume is some basic math and a willingness to pick up a bit of abstract math along the way. I try to explain everything as intuitively as possible, but, despite that, the article still demands some serious effort from the reader.

When I analyzed the Extended Euclidean Algorithm, one thing led to another, and I ended up writing a little intro to generating functions. You can even jump to that part and ignore the rest, if you want! Other readers may instead choose to skip that section altogether, as it's self-contained.

mkornaukhov 3 hours ago

I've recently understood how RSA works and thought it was a cool achievement. But this article with "basic" math... Not so enjoyable for just a dev =)

joezydeco 6 hours ago

Your definition of "basic math" greatly differs from mine...

  • j16sdiz 5 hours ago

    > abstract algebra is not a requirement.

    and talks about fields and groups

    • mrkeen 3 hours ago

      They're just spooky names for simple concepts - and the article defines them on first use. If abstract algebra were a requirement, they'd skip these definitions.

      Paraphrasing 'Group' from the article to see if I've understood it:

      A set of elements G, and some operation ⊕, where

        (g1 ⊕ g2) is also in G. // "Type-safety"
      
        Some g0 exists such that (gn ⊕ g0) == (g0 ⊕ gn) == gn // "Zero"
      
        For every g, there's some inverse gi such that (g ⊕ gi) == (gi ⊕ g) == g0 // "Cancelling-out"
      
        a ⊕ (b ⊕ c) == (a ⊕ b) ⊕ c // "Associative"
      
        If (a ⊕ b) == (b ⊕ a) then the group is also "abelian/commutative"
      • bbarnett 29 minutes ago

        Is the aspirin symbol you're using as + figure, a special kind of +, or just a different looking +? What does the circle around the + mean?

        I'm mentioning this, as other people in this thread are discussing "explaining symbols you use", and you're using a non-standard symbol for +. I can easily imagine a circle around + making + a different operation, and wonder if it is so?

        Aspirin I've bought in the past has a + on it, and its trademark is a + within a circle. That's why I've latched on what a "common person" might view the symbol as:

        https://www.brand.aspirin.com/sites/g/files/vrxlpx46831/file...

        Interestingly, I have University level math courses, but decades out of date, and have never run into that symbol. I see it here:

        https://en.wikipedia.org/wiki/Direct_sum

      • letmetweakit an hour ago

        They're spooky names for simple concepts, with extremely deep consequences and hard theory, don't be fooled.

NetMageSCW 5 hours ago

The article would be a lot better if it was what it said on the tin, instead of being filled with lots of unnecessary (as described in the article) digressions. If you couldn’t restrain yourself to sticking to the subject, at least put the digressions behind links or footnotes or pop-ups where they don’t detract from reading about the actual claimed intended subject.

atoav 2 hours ago

A big part of what makes maths hard for non-math-people is math notation. That is like if a well versed python programmer told you it is as simple as:

  result = [[{"x": x, "y": y, "v": (x+y if (x+y)%2==0 else None)} for (x, y) in row] for row in data]  
  
Now with a bit of reasoning another programmer that hasn't used python might be able to figure out what that means. But what if my audience is non-programmers? The moment they encounter the first unexplained square brackets and then an opening curly brace it will essentially feel like telling them: "Here is a riddle for you" or potentially even like "I expect you to know this, dummy".

Not that this text was particular bad in that regard, but I wish more math people had a heightened awareness of the fact that for many the hard part is not understanding the concept (e.g. fourier transformation), but the foreign looking signs mathematicians have decided to use to write them down.

That is as if someone explaines the way to the next train station to you in a foreign language. The hard part isn't understanding the way, it is understanding the noises that are supposed to make up the description.

And as a programmer who from time to time has to translate maths into discrete programs (or the other way around) the hard part was always parsing the notation and when I figured it out I was usually like: "Ohh, this is just a simple algorithm doing that.

So if you want to explain a math concept to programmers you should chose one of two routes:

(A) Stay with your notation and explain every character that isn't visible on a regular keyboard in length and gently lead the reader into being able to read the notation or

(B) let go of the notation and first explain what it does and how, e.g. for our FFT example: FFT slices your list of values into frequency buckets, figures out how much of each frequency is present, and returns those strengths as numbers. And then you can work backwards from that understanding towards your notation explaining which sign relates to which part of the concept (e.g. to the number of buckets).

I would prefer the latter, since it explains both the concept and gives the mathematician a chance to explain how and why math notation can be useful on top, e.g. to figure out certain properties of the method that may even have practical implications.

  • mac-monet an hour ago

    Was nodding along as I was reading this. I recently was given a paper and spoke with the engineer implementing it. The paper was incredibly dense and hard to parse. But through talking with the engineer and rewriting some terms to more common names, the math turned out to be quite simple. Echoing your sentiment, I wish more mathematicians would use simple terminology. My personal theory as to why this isn't done is the same reason why overengineering happens, that the writer is trying to cover every base but makes the hottest path a jumbled mess.

some_furry 2 hours ago

In addition to the malleability attack (high-S and low-S both being valid for a given value of R), ECDSA doesn't provide a property called exclusive ownership: https://soatok.blog/2023/04/03/asymmetric-cryptographic-comm...

In contrast, EdDSA (which is based on Schorr signatures) does, by construction: the public key is included in one of the hashes, which binds the signature to a particular public key.

I haven't investigated whether cryptocurrency's use of Schnorr satisfies this property or not. (Indeed, I do not care about cryptocurrency at all.) So it's an exercise to the reader if it's satisfactory or not :3

[removed] 7 hours ago
[deleted]