Skip to content

Cannot reproduce EdDSA signature #2298

Answered by idcmp
idcmp asked this question in Q&A
Dec 9, 2022 · 6 comments · 5 replies
Discussion options

You must be logged in to vote

Solved. I generate a ed25519 key inside Go:

	pubKey, privKey, err := ed25519.GenerateKey(rand.Reader)

I use the example code from the issue you linked to convert the Go private key to a lib private key:

func privKeyToLibPrivKey(privKeyIn []byte) []byte {
	hash := sha512.New()
	hash.Write(privKeyIn[:32])
	hashBytes := hash.Sum(nil)

	hashBytes[0] &= 248
	hashBytes[31] &= 63
	hashBytes[31] |= 64

	return hashBytes
}

To make a Sparkle key:

	libPrivKey := privKeyToLibPrivKey(privKey)
	sparkleKeyBytes := append(libPrivKey, pubKey...) // append regular public key
	sparkleKey := base64.StdEncoding.EncodeToString(sparkleKey) // use StdEncoding to pad output

I pass libPrivKey into the privBuf a…

Replies: 6 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@zorgiepoo
Comment options

@idcmp
Comment options

Comment options

You must be logged in to vote
1 reply
@zorgiepoo
Comment options

Comment options

You must be logged in to vote
2 replies
@zorgiepoo
Comment options

@zorgiepoo
Comment options

Answer selected by idcmp
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
Converted from issue

This discussion was converted from issue #2297 on December 09, 2022 01:51.