#include #include //#include #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; }