发新话题
打印

如何利用C#产生随机密码字符串

如何利用C#产生随机密码字符串

相关代码如下:


using System;
using System.Security.Cryptography;
using System.Text;
namespace Utility {
      public class PasswordGenerator {
            public PasswordGenerator() {
                  this.Minimum = DefaultMinimum;
                  this.Maximum = DefaultMaximum;
                  this.ConsecutiveCharacters = false;
                  this.RepeatCharacters = true;
                  this.ExcludeSymbols = false;
                  this.Exclusions = null;
                  rng = new RNGCryptoServiceProvider();
            }
            protected int GetCryptographicRandomNumber(int lBound, int uBound) {  
                  // 假定 lBound >= 0

TOP

发新话题