Skip to content

Convert getSharedSecret output to 32 bytes and ECDH_compute_key #114

Answered by paulmillr
vxow asked this question in Q&A
Discussion options

You must be logged in to vote

if it's 32 bytes, then it's either:

a. SLICED: res.slice(1, 33)
b. HASHED: sha256(res.slice(1, 33))
c. HKDFED: hkdf_sha256(res.slice(1, 33))
d. SLICED and HASHED/HKDFED: b or d, but replace res.slice(1, 33) with decompRes.slice(1, 65), res.slice(0, 33) or decompRes.slice(0, 65)

There is no standard for ECDH. 32 bytes, 33 bytes, hashing or kdfing all make sense depending on ones needs. We provide the most flexible output, that can be converted to anything you'd like.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@vxow
Comment options

@TobyEalden
Comment options

@paulmillr
Comment options

Answer selected by paulmillr
@TobyEalden
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #113 on February 07, 2024 02:21.