//======================================================
// Verification Process of (projected) SFLASH
// reads in public key from public_key.txt and message/signature from signature.txt
// outputs TRUE if signature is valid and FALSE otherwise
// ============================================================

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

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 n-a do
	for j:=1 to n-s do
		hash2[i]:=Evaluate(hash2[i],x[j],signature[j]);
	end for;
end for;
hash2:=hashspace!(hash2);

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




