65.9K
CodeProject 正在变化。 阅读更多。
Home

生成随机密码

emptyStarIconemptyStarIconemptyStarIconemptyStarIconemptyStarIcon

0/5 (0投票)

2013 年 10 月 11 日

CPOL
viewsIcon

5080

这是一种简单有效的随机密码生成方法。Public Function GeneratePassword(ByVal PwdLength As Integer) As String   

这是一种简单有效的随机密码生成方法

Public Function GeneratePassword(ByVal PwdLength As Integer) As String
    Dim _allowedChars As String = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789"
    Dim rndNum As New Random()
    Dim chars(PwdLength - 1) As Char
    Dim strLength As Integer = _allowedChars.Length
    For i As Integer = 0 To PwdLength - 1
        chars(i) = _allowedChars.Chars(CInt(Fix((_allowedChars.Length) * rndNum.NextDouble())))
    Next i
    Return New String(chars)
End Function

 

尼米什·加格 (Nimish Garg)
软件开发人员
印度马特互联有限公司,诺伊达

获取免费的 ASP.NET 和 Oracle 代码片段
关注:http://nimishgarg.blogspot.com

© . All rights reserved.