mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 02:22:28 +00:00
@@ -105,12 +105,17 @@ static NSString *mergeWithoutDuplicates(NSString* baseCharacters, NSString* cust
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (CGFloat)entropyWhithPossibleCharacterSet:(MPPasswordCharacterFlags)allowedCharacters orCustomCharacters:(NSString *)customCharacters {
|
- (CGFloat)entropyWhithPossibleCharacterSet:(MPPasswordCharacterFlags)allowedCharacters orCustomCharacters:(NSString *)customCharacters {
|
||||||
CGFloat alphabetCount = customCharacters.length;
|
NSString *characters = nil;
|
||||||
if(nil == customCharacters) {
|
if(nil == customCharacters) {
|
||||||
NSString *stringSet = allowedCharactersString(allowedCharacters);
|
characters = allowedCharactersString(allowedCharacters);
|
||||||
alphabetCount = stringSet.length;
|
|
||||||
}
|
}
|
||||||
CGFloat passwordLegnth = self.length;
|
else {
|
||||||
return passwordLegnth * ( log10(alphabetCount) / log10(2) );
|
NSString *characters = mergeWithoutDuplicates(
|
||||||
|
allowedCharactersString(allowedCharacters),
|
||||||
|
customCharacters);
|
||||||
|
}
|
||||||
|
CGFloat alphabetCount = characters.length;
|
||||||
|
CGFloat passwordLength = self.length;
|
||||||
|
return passwordLength * ( log10(alphabetCount) / log10(2) );
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|||||||
Reference in New Issue
Block a user