ReadyGo!技术成就梦想 >> .Net技术 >> C# >> 如何利用c产生随机密码字符串

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

ReadyGo!技术成就梦想 www.efish.cn efish 2007-10-18 2:50:53
·关注web2.0创业 如何利用博客来赚钱
·木马病毒如何利用文件关联和设置名感染
·如何利用html格式化你的硬盘
·如何利用局域网来实现vlan的实例
·开发应用时如何利用c#自定义属性
·windows xp 中如何利用sysprep工具审核安
·如何利用1.10版赚钱或者破产
·如何利用路由器防止dos攻击
·如何利用sql 注入遍历目录
·如何利用apache+tomcat配置jsp开发环境?

相关代码如下:


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 && lbound < ubound
                  // 返回一个 int >= lbound and < ubound
                  uint urndnum;  
                  byte;   

                  if (lbound == ubound-1) {
                        // 只有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

相关文章
使用c创建sql server的存储过程 作者:bipin joshi翻译:webabcd介绍  通常,开发人员使用的是t-sql来创建sql server的存储过程、函数和触..
c 开发和使用中的23个技巧 1.怎样定制vc#datagrid列标题?   datagridtablestyle dgts = new datagridtablestyle();   dgts.ma..
利用.net directory类轻松进行目.. 我们将为大家介绍利用directory类处理路径中的目录部分。该类位于system.io 命名空间。directory类为我们提..
详细介绍有关于.net的委托 .net学习中,你碰到过委托吗?我接触.net几个月以来,关于委托的确花了我好长时间才弄明白,这里我就c#中的..
.net并不意味着vb.net或c 很有趣,当人们想到.net 公共语言运行时(clr)时,它们往往想到vb.net或c#。但是实际上它们只是支持clr的大..
使用微软消息队列实现c进程间通信 顾名思义,微软消息队列(msmq)是一种给队列发送消息以便稍后进行处理的方法。消息由一个“producer”(生..
2秒记住本站域名

玩过泡泡龙吗?Readygo?Go! 再加上.Com.Cn的后缀,那就是大名小顶的ReadyGo.com.cn

分类导航
ReadyGo!技术成就梦想