-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
std/crypto: add (X)Salsa20 and NaCl boxes #6809
Conversation
The NaCl constructions are available in pretty much all programming languages, making them a solid choice for applications that require interoperability. Go includes them in the standard library, JavaScript has the popular tweetnacl.js module, and reimplementations and ports of TweetNaCl have been made everywhere. Zig has almost everything that NaCl has at this point, the main missing component being the Salsa20 cipher, on top on which NaCl's secretboxes, boxes, and sealedboxes can be implemented. So, here they are! And clean the X25519 API up a little bit by the way.
Why does X25519 use a |
Ed25519 will move to using a These are quite different from X25519 key pairs, as the actual secret key is not stored. What is stored as a "secret" is a concatenation of the seed and the public key. Changing that interface requires too many changes unrelated to the topic of this PR, so that will be done separately. |
Not a lot of changes needed to move ed25519 key pairs to a struct, after all. So, added here as well. |
Why is the |
EdDSA requires the public key in addition to the secret key for signing. If the public key has to be recomputed every time a message has to be signed, it has a noticeable performance impact. In addition to that, EdDSA fails catastrophically if the wrong public key is used to compute a signature. For these reasons, the most common way to serialize EdDSA secret keys is as an aggregate of the seed (the secret scalar wouldn't be enough) and the public key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry I didn't finish my review before this was merged >>
The NaCl constructions are available in pretty much all programming languages, making them a solid choice for applications that require interoperability.
Go includes them in the standard library, JavaScript has the popular tweetnacl.js module, and reimplementations and ports of TweetNaCl have been made everywhere.
Zig has almost everything that NaCl has at this point, the main missing component being the Salsa20 cipher, on top on which NaCl's secretboxes, boxes, and sealedboxes can be implemented.
So, here they are!
And clean the X25519 API up a little bit by the way.