#include <stdio.h>
#include <memory.h>
//#include <assert.h>
#include "ed25519.cuh"
#include "ge.cuh"
#include "sha512.cuh"
#include "onion.cuh"
void print_value_hex (void *value, int length) {
for (int i = 0; i < length; ++i) {
printf("X", ((unsigned char*)value)[i]);
}
}
#define PRINT_VALUE_HEX(_value) print_value_hex(_value, sizeof(_value))
// choose desirable components
#define CREATE_SEED
#define CALCULATE_KEYS_HERE
#define CALCULATE_CHECKSUM
int main(int argc, char **argv) {
unsigned char seed[32];
unsigned char private_key[64];
unsigned char public_key[32];
unsigned char checksum[200];
printf("---------- Test batch with single key pair ----------\n");
#ifdef CREATE_SEED
ed25519_kernel_create_seed(seed,1);
#else
memcpy (seed, "01234567890123456789012345678901", 32);
#endif
printf ("seed is:\n");
PRINT_VALUE_HEX(seed);
printf ("\n");
#ifdef CALCULATE_KEYS_HERE
ge_p3 A;
sha512(seed, 32, private_key);
private_key[0] &= 248;
private_key[31] &= 63;
private_key[31] |= 64;
ge_scalarmult_base(&A, private_key);
ge_p3_tobytes(public_key, &A);
#else
ed25519_kernel_create_keypair_batch (public_key, private_key, seed, 1);
#endif
printf("Private Key\n");
PRINT_VALUE_HEX(private_key);
printf ("\n");
printf("Public Key\n");
PRINT_VALUE_HEX(public_key);
printf ("\n");
#ifdef CALCULATE_CHECKSUM
onion_address (public_key, checksum);
printf("Checksum\n");
PRINT_VALUE_HEX(checksum);
printf ("\n");
#endif
return 0;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}