Sha256: 3068c2bf6df543a16dddce8f9e89fe9fa630a1844b19aa6f13d0e3f77bdcf9f8

Contents?: true

Size: 528 Bytes

Versions: 6

Compression:

Stored size: 528 Bytes

Contents

#include <string.h>

#include "crypto_hash_sha512.h"
#include "crypto_scalarmult_curve25519.h"
#include "api.h"
#include "randombytes.h"

int crypto_box_seed_keypair(
  unsigned char *pk,
  unsigned char *sk,
  const unsigned char *seed
)
{
  unsigned char hash[64];
  crypto_hash_sha512(hash,seed,32);
  memmove(sk,hash,32);
  return crypto_scalarmult_curve25519_base(pk,sk);
}

int crypto_box_keypair(
  unsigned char *pk,
  unsigned char *sk
)
{
  randombytes_buf(sk,32);
  return crypto_scalarmult_curve25519_base(pk,sk);
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rbnacl-libsodium-1.0.5 vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c
rbnacl-libsodium-1.0.4 vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c
rbnacl-libsodium-1.0.3 vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c
rbnacl-libsodium-1.0.2 vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c
rbnacl-libsodium-1.0.1 vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c
rbnacl-libsodium-1.0.0 vendor/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c