mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-24 13:29:46 +00:00
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:
@@ -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) );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user