/* -------------------------------------------------------------
Verification Process of HFEv- Signature Scheme
loads public key from public_key.txt and signature and hash value from signature.txt
checks if signature is a valid UOV Signature for the hash value and outputs TRUE or FALSE
---------------------------------------------------------------*/

printf "******************************************************* \n";
printf "*** HFEv- Signature Scheme - Signature Verification *** \n";
printf "******************************************************* \n \n";

clear ;

timet := Cputime();

load "public_key.txt";
load "signature.txt";

printf"signature:= %o \n \n", signature;
printf"hashvalue:= %o \n \n", hash;

hash2:=Pk;
for i:=1 to m-a do
	for j:=1 to n do
		hash2[i]:=Evaluate(hash2[i],Pol.j,signature[j]);
	end for;
end for;
hash2:=hashspace!(hash2);

printf"P(signature):= %o \n \n", hash2;

if hash eq hash2 then
	printf"CORRECT!\n";
else
	printf"FALSE!\n";
end if;

printf "\nTime to check signature : %o\n",Cputime(timet) ;


