1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-23 20:15:19 -07:00

Change crypto_box_seed_keypair to use SHA-512 of the seed

This makes it compatible with what js-nacl and racl do.
This commit is contained in:
Jan Varho 2014-05-23 10:23:15 +03:00 committed by Frank Denis
parent c4f7adeda4
commit 9f52b0f0e9
2 changed files with 12 additions and 9 deletions

View File

@ -1,5 +1,6 @@
#include <string.h> #include <string.h>
#include "crypto_hash_sha512.h"
#include "crypto_scalarmult_curve25519.h" #include "crypto_scalarmult_curve25519.h"
#include "api.h" #include "api.h"
#include "randombytes.h" #include "randombytes.h"
@ -10,7 +11,9 @@ int crypto_box_seed_keypair(
const unsigned char *seed const unsigned char *seed
) )
{ {
memmove(sk, seed, 32); unsigned char hash[64];
crypto_hash_sha512(hash,seed,32);
memmove(sk,hash,32);
return crypto_scalarmult_curve25519_base(pk,sk); return crypto_scalarmult_curve25519_base(pk,sk);
} }

View File

@ -1,8 +1,8 @@
,0x85,0x20,0xf0,0x09,0x89,0x30,0xa7,0x54 ,0xed,0x77,0x49,0xb4,0xd9,0x89,0xf6,0x95
,0x74,0x8b,0x7d,0xdc,0xb4,0x3e,0xf7,0x5a ,0x7f,0x3b,0xfd,0xe6,0xc5,0x67,0x67,0xe9
,0x0d,0xbf,0x3a,0x0d,0x26,0x38,0x1a,0xf4 ,0x88,0xe2,0x1c,0x9f,0x87,0x84,0xd9,0x1d
,0xeb,0xa4,0xa9,0x8e,0xaa,0x9b,0x4e,0x6a ,0x61,0x00,0x11,0xcd,0x55,0x3f,0x9b,0x06
,0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d ,0xac,0xcd,0x44,0xeb,0x8e,0x93,0x31,0x9c
,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45 ,0x05,0x70,0xbc,0x11,0x00,0x5c,0x0e,0x01
,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a ,0x89,0xd3,0x4f,0xf0,0x2f,0x6c,0x17,0x77
,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a ,0x34,0x11,0xad,0x19,0x12,0x93,0xc9,0x8f