Пример #1
0
        public PasswordEntryView()
        {
            _showCommand = new Command(new Action <object>(ShowCommandAction));
            int recommendedCharSelection = SimpleRandomGenerator.GetTotalCharCountForSelection(SimpleRandomGenerator.CharSelection.Lowercase |
                                                                                               SimpleRandomGenerator.CharSelection.Uppercase |
                                                                                               SimpleRandomGenerator.CharSelection.Digits |
                                                                                               SimpleRandomGenerator.CharSelection.Minus |
                                                                                               SimpleRandomGenerator.CharSelection.Underline);

            _threshold = Math.Pow(12, recommendedCharSelection);
            InitializeComponent();
        }
Пример #2
0
        public static bool IsWeak(this Credential credential)
        {
            if (_weakThreshold == -1)
            {
                int recommendedCharSelection = SimpleRandomGenerator.GetTotalCharCountForSelection(SimpleRandomGenerator.CharSelection.Lowercase |
                                                                                                   SimpleRandomGenerator.CharSelection.Uppercase |
                                                                                                   SimpleRandomGenerator.CharSelection.Digits |
                                                                                                   SimpleRandomGenerator.CharSelection.Minus |
                                                                                                   SimpleRandomGenerator.CharSelection.Underline);
                _weakThreshold = Math.Pow(12, recommendedCharSelection);
            }
            double strength = SimpleRandomGenerator.GetStrength(credential.Password);

            return(strength < _weakThreshold);
        }