Курсовая работа: Программирование алгоритма цифровой подписи ГОСТ Р 34.10-94
if(fp1==NULL) printf("Error: couldn't open file");
if(rs==0) fprintf(fp1, "Verification successful: u=r', signature is authentic\n");
else fprintf(fp1, "WARNING: verification unsuccessful: u!=r', signature is non-authentic\n");
printf("Operations complete. Result of operation writed to \"verification result.txt\"\n");
fclose(fp1);
break;
case 2:
signature(p,a,q,x,m,k,sign);
file_write(sign, 0, S);
printf("Operation complete. Result of operation writed to \"signature.txt\"\n");
break;
case 3:
verify(p,a,q,y,m,sign);
rs=verify(p,a,q,y,m,sign);
if(rs==0) fprintf(fp1, "Verification successful: u=r', signature is authentic\n");
else fprintf(fp1, "WARNING: verification unsuccessful: u!=r', signature is non-authentic\n");
printf("Operation complete. Result of operation writed to \"verification result.txt\"\n");
break;
default: printf("Wrong number. Try again\n"); break;}}
while(1);}
Function.cpp
#include "function.h"
#include "INTERFS.h"
void signature(unsigned short sign_p[], unsigned short sign_a[], unsigned short sign_q[], unsigned short sign_x[], unsigned short sign_m[], unsigned short sign_k[], unsigned short sign[])
{unsigned short w[S*2];
unsigned short res[S];
unsigned short result[S];
unsigned short tmp[S/2];
unsigned short tmp1[S/2];