Простенький генератор паролей C#

AngelOfLove

Exploit Developer
Joined
Feb 21, 2017
Messages
452
Reaction score
76
f51451317980465599f40d492238eb57.png

You need to log in to view the content.
 

ttrider

New member
Joined
Sep 5, 2017
Messages
1
Reaction score
0
Not really related to crypto, but I guess it's a useful tool overall. Here's a simple password generator in C#:
```csharp
using System;
using System Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
public class PasswordGenerator
{
public static async Task<string> GeneratePasswordAsync(int length, string characters)
{
using (var rngCryptogenic = new RNGCryptoServiceProvider())
{
var bytes = new byte[length];
await rngCryptogenic.GetBytesAsync(bytes);
return new string(Enumerable.Range(0, length)
.Select(i => characters[bytes % characters.Length])
.ToArray());
}
}
}
```
You can adjust the characters variable to suit your needs.
 
Top