23 #ifndef CRYPTO_NEWHOPE_h
24 #define CRYPTO_NEWHOPE_h
28 #define NEWHOPE_SENDABYTES 1824
29 #define NEWHOPE_SENDBBYTES 2048
30 #define NEWHOPE_SHAREDBYTES 32
33 #define NEWHOPE_SMALL_FOOTPRINT 1
35 #define NEWHOPE_SMALL_FOOTPRINT 0
41 #if NEWHOPE_SMALL_FOOTPRINT
44 uint16_t coeffs[1024];
64 Variant variant =
Ref,
const uint8_t *random_seed = 0);
65 static void sharedb(uint8_t shared_key[NEWHOPE_SHAREDBYTES],
66 uint8_t send[NEWHOPE_SENDBBYTES],
67 uint8_t received[NEWHOPE_SENDABYTES],
68 Variant variant =
Ref,
const uint8_t *random_seed = 0);
69 static void shareda(uint8_t shared_key[NEWHOPE_SHAREDBYTES],
71 uint8_t received[NEWHOPE_SENDBBYTES]);
NewHope post-quantum key exchange algorithm.
static void sharedb(uint8_t shared_key[NEWHOPE_SHAREDBYTES], uint8_t send[NEWHOPE_SENDBBYTES], uint8_t received[NEWHOPE_SENDABYTES], Variant variant=Ref, const uint8_t *random_seed=0)
Generates the public key and shared secret for Bob.
static void keygen(uint8_t send[NEWHOPE_SENDABYTES], NewHopePrivateKey &sk, Variant variant=Ref, const uint8_t *random_seed=0)
Generates the key pair for Alice in a New Hope key exchange.
Variant
Describes the variant of the New Hope algorithm to implement.
@ Ref
The standard "reference" version of the New Hope algorithm.
@ Torref
The alternative "torref" version of the New Hope algorithm.
static void shareda(uint8_t shared_key[NEWHOPE_SHAREDBYTES], const NewHopePrivateKey &sk, uint8_t received[NEWHOPE_SENDBBYTES])
Generates the shared secret for Alice.
NewHope private key representation.