-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.c
30 lines (24 loc) · 1.03 KB
/
test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "monocypher/monocypher.h"
#include "monocypher/sha512.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void main(){
// void crypto_sign(uint8_t signature[64],
// const uint8_t secret_key[32],
// const uint8_t public_key[32], // optional, may be null
// const uint8_t *message, size_t message_size);
// int crypto_check(const uint8_t signature[64],
// const uint8_t public_key[32],
// const uint8_t *message, size_t message_size);
uint8_t signature[64];
const uint8_t secret_key[32] = "GophersaresuchafunthingHeHeHeHeH";
// const uint8_t pub_key[32] = "HackingHackingguysthisissomuchfu";
uint8_t pub_key[32];
const uint8_t *plaintext = "HellothisisGopherarmyawearegonnarulethisworld";
size_t text_size = strlen(plaintext);
crypto_sign_public_key(pub_key,secret_key);
crypto_sign(signature,secret_key,pub_key,plaintext,text_size);
int a = crypto_check(signature, pub_key,plaintext,text_size);
printf("Result: %d\n",a); // Output is always -1
}