jedisct1/libsodium — pull request #161 by jvarho (2014-05-23 08:08:05+00:00)
Title: Add crypto_box_seed_keypair

Deriving a crypto_box keypair from seed is something bindings in other languages already implement. At least PyNaCl and js-nacl have their own implementations.

This patch "derives" the keypair simply by using the seed as the secret key. That way it also resolves #81. It's what PyNaCl does.

Alternatively, there's a patch on top of this that changes the function to use the SHA-512-256, which is what js-nacl does: https://github.com/jvarho/libsodium/tree/seed-keypair-js-nacl

If you go that way, storing the secret key isn't enough to derive the public key, which is sort of weird and inconsistent with crypto_sign. Then you'd really want to change the secret key to be just the seed, which wouldn't be backwards compatible.