BachelorWork/appendixes/BC_ZK/demoExamples/rtlgenrandom.c
2021-05-28 00:53:37 +02:00

28 lines
824 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<windows.h> // for variable types definition
#include<ntsecapi.h> // declaration RtlGenRandom()
int main(){
BYTE *pbData=(BYTE*)malloc(sizeof(BYTE) * 10);
if(RtlGenRandom(pbData,10) == TRUE){
for (int i = 0; i < 10; i++){
printf("%u",pbData[i]);
}
free(pbData);
return 0;
}
free(pbData);
return -1;
}