# Super Simple .NET 6

To create a blank .NET program, run the following:
```
dotnet new console
```
# Random Numbers
This is a stupidly simple .NET program for [generating some crypto-random numbers](https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.randomnumbergenerator?view=net-6.0) using the [operating system's entropy](https://blogs.siliconorchid.com/post/coding-inspiration/randomness-in-dotnet/):

**Program.cs** (the entire file is shown here, using [top-level statements](https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/program-structure/top-level-statements) from C# 9)

```
using System.Security.Cryptography;

Console.WriteLine("Here's some random 32 byte base64 strings\n");
var r = RandomNumberGenerator.Create();
byte[] rand = new byte[32];
for (int i = 0; i < 5; i++)
{
    r.GetBytes(rand);
    Console.WriteLine(Convert.ToBase64String(rand));
}
Console.WriteLine();
```

# BCrypt
This is a stupidly simple .NET program for creating BCrypt hashes, which you can use to populate a development database with known hashes.

After running `dotnet new console`, run `dotnet add package BCrypt.Net-Next` to [install](https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-dotnet-cli) BCrypt.

**Program.cs** (the entire file is shown here, using [top-level statements](https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/program-structure/top-level-statements) from C# 9)

```
Console.WriteLine("Here's some bcrypt hashes for the password 1234\n");
string hash;
for (int i = 0; i < 5; i++)
{
    hash = BCrypt.Net.BCrypt.HashPassword("1234");
    Console.WriteLine(hash);
}
Console.WriteLine();
```

