https://github.com/vanhakobyan/rngcryptoservicepassgen
:barber:RNGCryptoService:barber: password generator:barber:
https://github.com/vanhakobyan/rngcryptoservicepassgen
cryptography password password-generator rng service
Last synced: 4 months ago
JSON representation
:barber:RNGCryptoService:barber: password generator:barber:
- Host: GitHub
- URL: https://github.com/vanhakobyan/rngcryptoservicepassgen
- Owner: VanHakobyan
- Created: 2017-01-10T17:55:38.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-30T19:01:11.000Z (over 8 years ago)
- Last Synced: 2025-02-09T06:13:46.677Z (8 months ago)
- Topics: cryptography, password, password-generator, rng, service
- Language: C#
- Homepage:
- Size: 8.79 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RNGCryptoService password generator
![]()
Example. The most useful method on RNGCryptoServiceProvider is the GetBytes method. And because this type implements Dispose, you can enclose it in a using-statement. We fill a four-byte array with GetBytes ten times.
```C#
using System;
using System.Security.Cryptography;class Program
{
static void Main()
{
using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider())
{
// Buffer storage.
byte[] data = new byte[4];// Ten iterations.
for (int i = 0; i < 10; i++)
{
// Fill buffer.
rng.GetBytes(data);// Convert to int 32.
int value = BitConverter.ToInt32(data, 0);
Console.WriteLine(value);
}
}
}
}```
### The library consists of
```c#
public enum optionPass
{
pasSize,
pasUpperOnly,
pasSmallOnly,
pasDigitOnly,
pasDigitUpperSmall}
...
...
...
public Password(optionPass passOpt, int length)
{
getPassword = NewPassword(passOpt, length).ToString();
}```