The simplified per-position formula for calculating the total number of combinations in a mask or password range is:
S = Cn, where S is the total number of combinations, C is the number of characters in a charset and n is the total length of the password range.
Example.
The password uses loweralpha ([a;z], 26 characters total) and has a total of 8 letters ([8;8], meaning min length=max length=8).
For maskprocessor, it will look like ā?l?l?l?l?l?l?l?lā.
The total number of combinations is 268=208827064576.
Divide that by your measured speed (per second) to get the time the attack would take, in seconds.
If the password range is not of constant length, use the same formula for each length in the range:
The formula is expanded to S = Cn + Cn+1 + ⦠+ Cm-1 + Cm, where the password length is expressed as [n;m]
Example.
The password uses the mixalpha-numeric charset ([a;z] + [A;Z] + [0;9], 62 characters total) and ranges from 1 to 6 characters ([1;6]).
For MP, it will look like:
-1 ?l?d?u ?1 -1 ?l?d?u ?1?1 -1 ?l?d?u ?1?1?1 -1 ?l?d?u ?1?1?1?1 -1 ?l?d?u ?1?1?1?1?1 -1 ?l?d?u ?1?1?1?1?1?1
The total number of combinations for that configuration is 62 + 622 + 623 + 624 + 625 + 626 = 57731386986
If the mask is complex, calculations are needed for each character position.
The formula is hard to express, but the idea is straightforward: each position in a password range can be occupied by a certain number of characters.
If the range has a fixed length, multiply those numbers.
If the range has different minimum and maximum lengths, calculate the combinations for each length and add the results.
Example.
You know the password is Passw0rd, so you set the mask to be ?u?l?l?l?l?d?l?l.
The number of combinations for ?l is the same as for ?u, which is 26. For ?d, it is 10. Multiply these numbers for all positions: 26 * 26 * 26 * 26 * 26 * 10 * 26 * 26 = 80318101760.
Example.
You want to run a ?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d job on hashcat, where
-1 = ?l?d?u = 62 chars
-2 = ?l?d = 36 chars
-3 = ?l?d*!$@_ = 41 chars
The total number of combinations for this mask is 62 * 366 * 414 * 104 = 3813661310945771520000.
This illustrates a keyspace that is impossible to attack in a reasonable time. A fast machine running at 50 GH/s on MD5 would need roughly 2.458 years to complete it.