Skip to content

Question on private scalar derivation (ed25519) #109

Discussion options

You must be logged in to vote

I'll try to answer my own question here.

In the case of ed25519 signatures, this modulo operation does not have an effect, since we know that we are operating on points of the prime order subgroup.

In the case of x25519 this would have an effect, but here we are not applying the modulo operation.

function decodeScalar(n: Hex): bigint {
const bytes = ensureBytes('scalar', n);
const len = bytes.length;
if (len !== montgomeryBytes && len !== fieldLen)
throw new Error(`Expected ${montgomeryBytes} or ${fieldLen} bytes, got ${len}`);
return bytesToNumberLE(adjustScalarBytes(bytes));
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by matthiasgeihs
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants