Commit 163e8a7d authored by yids's avatar yids

added hexdump to keygen

parent b40b7bcd
......@@ -10,20 +10,44 @@
char shared_secret[SHARED_SECRET_SIZE];
char decompressed_point[64];
int main()
void hex_dump(struct pl_keypair *keypair)
{
struct pl_keypair *receiver, *sender;
struct pl_ctx * context;
context = pl_init(context);
printf("private key:\n");
printf("{");
for(int i=0; i < ECC_COMPRESSED_SIZE-1; i++){
printf("%02x, ", keypair->private_key[i]);
}
printf("}\ncompressed point:\n{");
for(int i=0; i < ECC_COMPRESSED_SIZE; i++){
printf("%02x, ", keypair->compressed_point[i]);
}
printf("}\n\n");
}
pl_create_keypair(context, sender);
pl_save_key(sender,"sender.keypair");
pl_create_keypair(context, receiver);
pl_save_key(receiver,"receiver.keypair");
int main()
{
struct pl_keypair *receiver, *sender;
struct pl_ctx * context;
context = pl_init(context);
sender = (struct pl_keypair *) malloc(sizeof(struct pl_keypair));
memset(sender, 9, sizeof(struct pl_keypair));
receiver = (struct pl_keypair *) malloc(sizeof(struct pl_keypair));
memset(receiver, 2, sizeof(struct pl_keypair));
pl_create_keypair(context, sender);
pl_save_key(sender,"sender.keypair");
pl_create_keypair(context, receiver);
pl_save_key(receiver,"receiver.keypair");
printf("sender key:\n");
hex_dump(sender);
printf("receiver key:\n");
hex_dump(receiver);
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment