Hi,
I am wondering if it is possible to generate a "key" that is valid for a period of (approximately) three months?
For example, let's say (hypothetically) that I generate a key like this (pseudocode):
Key = HASH ( MachineID, Salt );
And the way I verify a key is valid is to check like this:
isValid(Key)
{
return Key == HASH ( MachineID, Salt )
}
How would you extend this to generate a key like this:
Key = HASH ( MachineID, Salt, LastMonth, ThisMonth, NextMonth );
But still have your isValid work correctly?
One way I can see is:
isValid(Key)
{
return Key == HASH ( MachineID, Salt, (LastMonth), (ThisMonth), (NextMonth) )
|| Key == HASH ( MachineID, Salt, (LastMonth-1), (LastMonth), (ThisMonth) )
|| Key == HASH ( MachineID, Salt, (ThisMonth), (ThisMonth+1), (ThisMonth+2) )
}
But I would like to know if any better ideas come to mind.