- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
如何利用C#产生随机密码字符串(How to use C# to generate random password strings)
如何利用C#产生随机密码字符串(How to use C# to generate random password strings)
On high, wed be two birds flying wing to wing. On earth, two trees with branches twined from spring to spring。 Wind Supergrass, is general Cheng chen. Quiet, deep Buddhist temple garden. A thousand miles. Jujiu cage, in the river. A quiet and modest maiden, a gentlemans good mate. 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) {
Assume that / / lBound = 0 lBound uBound
Returns a int / and uBound = lBound
Uint urndnum;
Byte[] rndnum = new Byte[4];
If (lBound = = uBound-1) {
Only the return / / iBound
Return lBound;
}
Uint xcludeRndBase = (uint.MaxValue - (uint.MaxValue% (uint) (uBound-lBound)));
{do
Rng.GetBytes (rndnum);
Urndnum = System.BitConverter.ToUInt32 (rndnum, 0);
} while (urndnum = xcludeRndBase);
Return (int) (urndnum% (uBound-lBound)) + lBound;
}
Protected, char, GetRandomCharacter () {
Int upperBound = pwdCharArray.GetUpperBound (0);
If (true = = this.ExcludeSymbols) {
UpperBound = PasswordGenerator.UBoundDigit;
}
Int randomCharPosition = GetCryptographicRandomNumber (pwdCharArray.GetLowerBound (0), upperBound);
Char randomChar = pwdCharArray[randomCharPosition];
Return randomChar;
}
Public, string, Generate () {
Between minimum and maximum / random length
Int pwdLength = GetCryptographicRandomNumber (this.Minimum, this.Maximum);
StringBuilder pwdBuffer = new, StringBuilder ();
PwdBuffer.Capacity = this.Maximum;
/ / random character
Char, lastCharacter, nextCharacter;
/ / initial mark
lastcharacter = nextcharacter = \n;
为(int i = 0;i pwdlength;i++){
nextcharacter = getrandomcharacter()
您可能关注的文档
- 地震与动物天气地光(The earthquake and weather to animal).doc
- 地震科普知识宣传资料(Propaganda materials of earthquake science popularization).doc
- 地震知识介绍(Introduction to seismic knowledge).doc
- 地震纪念馆观后感 想~(My thoughts about the Earthquake Memorial to).doc
- 地面水 地下水(The surface water and groundwater).doc
- 地鼓练习(Floor exercise).doc
- 场效应管和电源IC好坏的判断(Field effect tube and power IC are good or bad judgment).doc
- 场效应管(MOS管)如何判断好坏(How can a field effect tube (MOS tube) be judged good or bad).doc
- 场效应管好坏判断及替换原则(The principle of good and bad judgment and replacement of field effect transistor).doc
- 均线技术兵法--均线背离与均线修复(Average technology, art of war - average deviation and average recovery).doc
- 如何利用厂家推出新产品的商机(How to use the new product launch opportunities).doc
- 如何利用均衡器改善音质(How to use equalizer to improve sound quality).doc
- 如何判别桂花树的品种(How to distinguish the species of Osmanthus fragrans).doc
- 如何制定或优化绩效考评方案(How to formulate or optimize performance appraisal plan).doc
- 如何利用车险(How to use auto insurance).doc
- 如何加快XP的速度(How do you speed up XP).doc
- 如何加快宽带速度(How to speed up broadband).doc
- 如何加强公司领导团队的建设(How to strengthen the construction of leadership team).doc
- 如何加快开机启动(How to speed up boot).doc
- 如何加快开机速度(How to speed up the boot).doc
文档评论(0)