An IRC bot to synchronize entropy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

39 lines
1.4 KiB

/* Copyright (C) 2021 Noisytoot
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <sodium.h>
#include "common.h"
int main() {
unsigned char pk[crypto_sign_PUBLICKEYBYTES];
unsigned char sk[crypto_sign_SECRETKEYBYTES];
char base64_pk[base64_pk_len];
char base64_sk[base64_sk_len];
if (sodium_init() == -1) {
fprintf(stderr, "error: sodium_init failed\n");
return 1;
}
crypto_sign_keypair(pk, sk);
sodium_bin2base64(base64_pk, base64_pk_len,
pk, crypto_sign_PUBLICKEYBYTES,
base64_variant);
sodium_bin2base64(base64_sk, base64_sk_len,
sk, crypto_sign_SECRETKEYBYTES,
base64_variant);
printf("private key: %s\npublic key: %s\n", base64_sk, base64_pk);
return 0;
}