|
-
Aug 26th, 2024, 06:40 AM
#1
Thread Starter
Lively Member
.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.
-
Aug 26th, 2024, 06:49 AM
#2
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/
-
Aug 27th, 2024, 12:07 AM
#3
Thread Starter
Lively Member
Re: .NET Framework 4.0 DLL or code for a random password generation
 Originally Posted by PlausiblyDamp
Tested , did not work for .NET framework 4.0.
-
Aug 27th, 2024, 02:14 AM
#4
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.
-
Oct 16th, 2024, 06:49 AM
#5
Thread Starter
Lively Member
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?
-
Oct 16th, 2024, 07:48 AM
#6
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.
-
Oct 16th, 2024, 09:23 AM
#7
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.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Oct 16th, 2024, 09:58 AM
#8
Re: .NET Framework 4.0 DLL or code for a random password generation
 Originally Posted by sapator
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.
-
Oct 17th, 2024, 08:21 AM
#9
Re: .NET Framework 4.0 DLL or code for a random password generation
 Originally Posted by IT_Researcher
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
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|