Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

Update to support the viewkey encodings in zcash/zips/#117#8

Merged
FiloSottile merged 3 commits intoFiloSottile:masterfrom
zmanian:FinalViewKeyEncodings
Feb 23, 2017
Merged

Update to support the viewkey encodings in zcash/zips/#117#8
FiloSottile merged 3 commits intoFiloSottile:masterfrom
zmanian:FinalViewKeyEncodings

Conversation

@zmanian
Copy link
Copy Markdown
Contributor

@zmanian zmanian commented Feb 21, 2017

There is now a specification for serialized viewing keys. Updated to conform to it.
zcash/zips#117

Comment thread zcash/address.go
prfAddr(viewKey, key, 1)
viewKey := make([]byte, 64)
prfAddr(viewKey, key, 0)
prfAddr(viewKey[32:], key, 1)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per sections 4.2 and 5.4.6 of the Zcash spec, the output of prfAddr(_, key, 1) needs to be clamped to a valid Curve25519 secret key in order to match the definition of sk_enc. I'm guessing this was unnecessary in askToPKenc() because curve25519.ScalarBaseMult() performs clamping internally.

@zmanian
Copy link
Copy Markdown
Contributor Author

zmanian commented Feb 23, 2017

Updated the implementation.

Wasn't sure if I want to always clamp the output of PRF(1) or just clamp when generating a viewing key. Went with the latter but could easily do the former.

@FiloSottile
Copy link
Copy Markdown
Owner

Perfect, thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants