30 lines
898 B
C
30 lines
898 B
C
|
/*
|
||
|
Organization: Technical University of Kosice (TUKE),
|
||
|
Department: Department of Electronics and Multimedia Telecommunications (DEMT/KEMT),
|
||
|
Faculties: Faculty of Electrical Engineering and Informatics (FEI),
|
||
|
Feld of study: Informatics,
|
||
|
Study program: Computer Networks,
|
||
|
School year: 3., Bachelor study, 2020/2021,
|
||
|
Author: Marek Rohac -- MR,
|
||
|
Compiler: Winlibs GCC -- MinGW-W64 x86_64-posix-seh, built by Brecht Sanders, v. 10.2.0,
|
||
|
-- also works with GCC 11.1.0
|
||
|
*/
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <openssl/rand.h>
|
||
|
|
||
|
int main(){
|
||
|
unsigned char * data =(unsigned char*)malloc(sizeof(unsigned char)*10);
|
||
|
if(RAND_bytes(data,10))
|
||
|
for (int i = 0; i < 10; i++)
|
||
|
printf("%u", data[i]);
|
||
|
else printf("RAND_bytes error\n");
|
||
|
printf("\n");
|
||
|
if (RAND_priv_bytes(data,10))
|
||
|
for (int i = 0; i < 10; i++)
|
||
|
printf("%u", data[i]);
|
||
|
else printf("RAND_priv_bytes error\n");
|
||
|
|
||
|
free(data);
|
||
|
return 0;
|
||
|
}
|