public int CalculateSleepSeconds(int failedLogins, int maxPasswordAttempts)
{
// Throttle, as suggested by http://www.codinghorror.com/blog/2009/01/dictionary-attacks-101.html
if (failedLogins > maxPasswordAttempts)
{
// sleep an extra second up to a max of 30 seconds
int sleepFor = (failedLogins < 30) ? failedLogins : 30;
return sleepFor;
}
return 0;
}