Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am doing the program of implementing ECDSA for which I am trying to solve the equation scenario. In ECDSA that signature generation algorithm which states as hash value from the SHA-1 and where $l$ denotes the leftmost bits of the hash.

For example of hash value de9f2c7fd25e1b3afad3e85a0bd17d9b100db4b3. In that hash value what is the leftmost bits represent in the z value?
Is it d or the last bit of binary of d such as 1101 which implies 1 in leftmost?

Let $z$ be the $L_n$ leftmost bits of $e$, where $L_n$ is the bit length of the group order $n$.

In my scenario the $n$ length is 17. I guess it is the $n=17$.

What does will have? Binary or hex value or decimal which is used in the calculation of $s$ in step 4?

share|improve this question

In binary, your hash value is:


And so the leftmost 17 bits would be 11011110100111110 or 1BD3E in hex.

Normally, for curves we actually use for ECDSA, $n$ is a multiple of 8 (and so we just use the leftmost $n/8$ bytes); in your (toy) case, we need to be a bit more careful (and end up not preserving byte boundaries).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.