Entropy is now calculated for Custom Alphabets in Password Generator View

Custom String in Password Generator View are now filtered to only include unique characters
This commit is contained in:
michael starke
2013-08-04 03:41:09 +02:00
parent 9d22494bf4
commit 450bc3d4dd
20 changed files with 902 additions and 279 deletions

View File

@@ -73,12 +73,11 @@ static NSString *allowedCharactersString(MPPasswordCharacterFlags flags) {
}
- (CGFloat)entropyWhithPossibleCharacterSet:(MPPasswordCharacterFlags)allowedCharacters orCustomCharacters:(NSString *)customCharacters {
if(nil != customCharacters) {
return 0; // We need a sophisticated parser here!
CGFloat alphabetCount = [customCharacters length];
if(nil == customCharacters) {
NSString *stringSet = allowedCharactersString(allowedCharacters);
alphabetCount = [stringSet length];
}
NSString *stringSet = allowedCharactersString(allowedCharacters);
CGFloat alphabetCount = [stringSet length];
CGFloat passwordLegnth = [self length];
return passwordLegnth * ( log10(alphabetCount) / log10(2) );
}