Results 1 to 9 of 9

Thread: .NET Framework 4.0 DLL or code for a random password generation

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2020
    Posts
    70

    .NET Framework 4.0 DLL or code for a random password generation

    I want a .NET Framework 4 DLL for a random password generator that satisfies these requirements:
    a) A minimum length of 7 characters,
    b) At least one special character,
    c) At least one alphabetic character,
    d) At least one numeric character (0-9)
    I specifically want it to work for .net framework 4.0 or 4.5.

  2. #2
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,958

    Re: .NET Framework 4.0 DLL or code for a random password generation

    No idea how good it is but a quick google search turned up https://github.com/prjseal/PasswordGenerator/

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2020
    Posts
    70

    Re: .NET Framework 4.0 DLL or code for a random password generation

    Quote Originally Posted by PlausiblyDamp View Post
    No idea how good it is but a quick google search turned up https://github.com/prjseal/PasswordGenerator/
    Tested , did not work for .NET framework 4.0.

  4. #4
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,958

    Re: .NET Framework 4.0 DLL or code for a random password generation

    From the description it should work, did it give any errors? How did you install it? If nothing else works it would probably take less than 5 minutes to compile a version that works on .Net 4 - even if that isn't possible then perhaps one of the older versions of the library can be used on .Net 4.5 instead.

    Then again 4.5 went out of official support over 2 years ago so it might be worth upgrading to 4.8 anyway (or at least 4.6.2) - especially as it should be a fairly trivial upgrade to the newer framework versions anyway.
    Last edited by PlausiblyDamp; Aug 27th, 2024 at 06:19 AM.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2020
    Posts
    70

    Re: .NET Framework 4.0 DLL or code for a random password generation

    What are the possible methods to downgrade a DLL project from .NET Standard 2.0 to .NET Framework 4.0 in Visual Studio?

  6. #6
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,958

    Re: .NET Framework 4.0 DLL or code for a random password generation

    Have you tried opening the project properties and setting the framework version to 4.0? If not that is probably the best first step.

  7. #7
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: .NET Framework 4.0 DLL or code for a random password generation

    How is 2.0 to 4.0 downgrade?
    Also using a GUID is probably a good way to go depending on what you have to do.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  8. #8
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,958

    Re: .NET Framework 4.0 DLL or code for a random password generation

    Quote Originally Posted by sapator View Post
    How is 2.0 to 4.0 downgrade?
    Also using a GUID is probably a good way to go depending on what you have to do.
    4.0 is the framework version. Standard 2.0 is a compatability version introduced around framework 4.5.

    I am assuming that the question related to source compatability with framework 4.0, although there are older versions available that are compatible (as I mentioned in a previous post). Not sure a GUID of have any impact on compatibility.

  9. #9
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: .NET Framework 4.0 DLL or code for a random password generation

    Quote Originally Posted by IT_Researcher View Post
    I want a .NET Framework 4 DLL for a random password generator that satisfies these requirements:
    a) A minimum length of 7 characters,
    b) At least one special character,
    c) At least one alphabetic character,
    d) At least one numeric character (0-9)
    I specifically want it to work for .net framework 4.0 or 4.5.
    This should work for most versions of .Net

    Code:
        Public Class RandoPassword
            Private Shared PRNG As New Random
            Private Shared alpha As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
            Private Shared nums As String = "0123456789"
            Private Shared spec As String = "{|}~!#$%&()*+-./:;<=>?@[\]^_`"
            Private Shared allchars As String = alpha & nums & spec
            ''' <summary>
            ''' generate a random password
            ''' </summary>
            ''' <param name="passLen">password length</param>
            ''' <param name="numAlpha">minimum number of alpha chars</param>
            ''' <param name="numSpecial">minimum number of special chars</param>
            ''' <param name="numNumeric">minimum number of numeric chars</param>
            ''' <returns>password as string</returns>
            ''' <remarks></remarks>
            Public Shared Function Generate(Optional passLen As Integer = 7,
                                             Optional numAlpha As Integer = 1,
                                             Optional numSpecial As Integer = 1,
                                             Optional numNumeric As Integer = 1) As String
    
                Dim rv As New List(Of Char)
                Dim CharsToGenerate As Integer = passLen
                If numSpecial + numNumeric + numAlpha > CharsToGenerate Then
                    'todo override minLen???
                    CharsToGenerate = numSpecial + numNumeric + numAlpha
                End If
                For ct As Integer = 1 To numAlpha 'add the alphas
                    rv.Add(alpha(PRNG.Next(alpha.Length)))
                Next
                For ct As Integer = 1 To numSpecial 'add the specials
                    rv.Add(spec(PRNG.Next(spec.Length)))
                Next
                For ct As Integer = 1 To numNumeric 'add the numeric
                    rv.Add(nums(PRNG.Next(nums.Length)))
                Next
                Do While rv.Count < CharsToGenerate 'add the rest
                    rv.Add(allchars(PRNG.Next(allchars.Length)))
                Loop
                rv = rv.OrderBy(Function(c) PRNG.Next).ToList 'sort
                Return String.Concat(rv) 'return
            End Function
        End Class
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width