Example: validation algorithm
In this example, the license key consists of two values, where the faculty of the first value has to be equal to the second value to be a regular license key. The following check-function will be used to validate the license key:
bool check(int key_part1, int key_part2)
{
if(fun(key_part1)==key_part2)
return true;
return false;
}
int fun(int key)
{
int a=1;
if (key<1)
a=1;
else
do{
a *= key--;
}while (key>1);
return a;
}