Exemple #1
0
        public JsonResult OnGet()
        {
            var output = new
            {
                WordShort     = wordGen.GeneratePassword(12, PasswordComplexity.High),
                WordLong      = wordGen.GeneratePassword(20, PasswordComplexity.High),
                ComplexShort  = complexGen.GeneratePassword(12, PasswordComplexity.Medium),
                ComplexLong   = complexGen.GeneratePassword(18, PasswordComplexity.Medium),
                Complex2Short = complexGen.GeneratePassword(12, PasswordComplexity.High),
                Complex2Long  = complexGen.GeneratePassword(18, PasswordComplexity.High),
                PIN4          = pinGen.GeneratePassword(4),
                PIN6          = pinGen.GeneratePassword(6),
                PIN8          = pinGen.GeneratePassword(8),
                PIN16         = pinGen.GeneratePassword(16),
            };

            return(new JsonResult(output));
        }
Exemple #2
0
        public void OnGet()
        {
            stopwatch.Reset();
            stopwatch.Start();
            ComplexPasswordGenerator   complexGen = new ComplexPasswordGenerator();
            WordBasedPasswordGenerator wordGen    = new WordBasedPasswordGenerator();
            NumericalPINGenerator      pinGen     = new NumericalPINGenerator();

            this.PasswordsComplexHigh = new List <string>();
            this.PasswordsComplexLow  = new List <string>();
            this.PasswordsWordsHigh   = new List <string>();
            this.PasswordsWordsMedium = new List <string>();
            this.PasswordsWordsLow    = new List <string>();
            this.PasswordsYubikeyLow  = new List <string>();
            this.PasswordsYubikeyHigh = new List <string>();
            this.PasswordsTwentyNine  = new List <string>();
            this.PasswordsPin4        = new List <string>();
            this.PasswordsPin6        = new List <string>();
            this.PasswordsPin8        = new List <string>();

            for (int x = 0; x < _numPasswordsToGenerate; x++)
            {
                PasswordsWordsHigh.Add(wordGen.GeneratePassword(18, PasswordComplexity.High));
                PasswordsWordsMedium.Add(wordGen.GeneratePassword(16, PasswordComplexity.Medium));
                PasswordsWordsLow.Add(wordGen.GeneratePassword(12, PasswordComplexity.Medium));
                PasswordsComplexHigh.Add(complexGen.GeneratePassword(64, PasswordComplexity.High));
                PasswordsComplexLow.Add(complexGen.GeneratePassword(64, PasswordComplexity.Medium));
                PasswordsPin4.Add(pinGen.GeneratePassword(4));
                PasswordsPin6.Add(pinGen.GeneratePassword(6));
                PasswordsPin8.Add(pinGen.GeneratePassword(8));
            }

            // So passwords are sorted strongest on bottom
            for (int x = 0; x < _numPasswordsToGenerate; x++)
            {
                PasswordsYubikeyHigh.Add(complexGen.GeneratePassword(32, PasswordComplexity.High));
                PasswordsYubikeyLow.Add(complexGen.GeneratePassword(32, PasswordComplexity.Medium));
                PasswordsTwentyNine.Add(complexGen.GeneratePassword(29, PasswordComplexity.Medium));
                PasswordsWordsHigh.Add(wordGen.GeneratePassword(18, PasswordComplexity.High));
                PasswordsWordsMedium.Add(wordGen.GeneratePassword(16, PasswordComplexity.Medium));
                PasswordsWordsLow.Add(wordGen.GeneratePassword(12, PasswordComplexity.Medium));
            }
            stopwatch.Stop();
        }