_current.size() returns the size of the password, _charset.size() returns the size of the charset.
however, by using a 5 char charset and a 7char password length i did not get a correct result. can anyone give me some pointers?
- Code: Select all
int mischief::brute::calculate_keyspace()
{
int keyspace = 0;
for(mischief::brutesize i = 0; i != _current.size(); ++i)
{
keyspace += mischief::math::pow(_charset.size(), i);
}
return keyspace;
}
int mischief::math::pow(const int number, int exponent)
{
if(exponent == 0) return 1; // n^0 = 1
int result = number;
while (--exponent)
{
result *= number;
}
return result;
}
the formula for calculating keyspace size is, as per the Cain & Abel help file, as follows:
The key space of all possible combination of passwords to try is calculated using the following formula:
KS = L^(m) + L^(m+1) + L^(m+2) + ........ + L^(M)
where
L = character set length
m = min length of the key
M = max length of the key
For example, when you want to crack an half of a LanManager passwords (LM) using the character set "ABCDEFGHIJKLMNOPQRSTUVWXYZ" of 26 letters, the brute-force cracker have to try KS = 26^1 + 26^2 + 26^3 + ...... + 26^7 = 8353082582 different keys.

