1
0
mirror of https://github.com/CPunch/Laika.git synced 2024-11-14 09:50:05 +00:00
Laika/tools/genkey/src/main.c
2022-02-24 22:13:05 -06:00

25 lines
617 B
C

#include <stdio.h>
#include <string.h>
#include "lerror.h"
#include "lsodium.h"
int main(int argv, char **argc) {
unsigned char priv[crypto_kx_SECRETKEYBYTES], pub[crypto_kx_PUBLICKEYBYTES];
char buf[256];
if (sodium_init() < 0) {
printf("Libsodium failed to init!\n");
return 1;
}
crypto_kx_keypair(pub, priv);
printf("[~] Generated keypair!\n");
sodium_bin2hex(buf, 256, pub, crypto_kx_PUBLICKEYBYTES);
printf("[~] public key: %s\n", buf);
sodium_bin2hex(buf, 256, priv, crypto_kx_SECRETKEYBYTES);
printf("[~] private key: %s\n\n", buf);
return 0;
}