# GenerateParameterDefault

- Kind: `class`
- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Version: `13.3.0`
- Namespace: `Aspire.Hosting.ApplicationModel`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/ParameterDefault.cs)
- Inherits: [ParameterDefault](/reference/api/csharp/aspire.hosting/parameterdefault.md)

Represents that a default value should be generated.

## Definition

```csharp
namespace Aspire.Hosting.ApplicationModel;

public sealed class GenerateParameterDefault
    : Aspire.Hosting.ApplicationModel.ParameterDefault
{
    // ...
}
```

## ATS metadata

### ATS DTO

- Serialized as a plain JSON object without a `$type` discriminator.

## Remarks

The recommended minimum bits of entropy for a generated password is 128 bits.

The general calculation of bits of entropy is:

`log base 2 (numberPossibleOutputs)`

This generator uses 23 upper case, 23 lower case (excludes i,l,o,I,L,O to prevent confusion), 10 numeric, and 11 special characters. So a total of 67 possible characters.

When all character sets are enabled, the number of possible outputs is `(67 ^ length)`. The minimum password length for 128 bits of entropy is 22 characters: `log base 2 (67 ^ 22)`.

When character sets are disabled, it lowers the number of possible outputs and thus the bits of entropy.

Using MinLower, MinUpper, MinNumeric, and MinSpecial also lowers the number of possible outputs and thus the bits of entropy.

A generalized lower-bound formula for the number of possible outputs is to consider a string of the form:

```csharp
{nonRequiredCharacters}{requiredCharacters}

let a = MinLower, b = MinUpper, c = MinNumeric, d = MinSpecial
let x = length - (a + b + c + d)

nonRequiredPossibilities = 67^x
requiredPossibilities = 23^a * 23^b * 10^c * 11^d * (a + b + c + d)! / (a! * b! * c! * d!)

lower-bound of total possibilities = nonRequiredPossibilities * requiredPossibilities
```

Putting it all together, the lower-bound bits of entropy calculation is:

```csharp
log base 2 [67^x * 23^a * 23^b * 10^c * 11^d * (a + b + c + d)! / (a! * b! * c! * d!)]
```

## Constructors

- [GenerateParameterDefault](/reference/api/csharp/aspire.hosting/generateparameterdefault/constructors.md#constructor)

## Properties

- [Lower](/reference/api/csharp/aspire.hosting/generateparameterdefault/properties.md#lower) : `bool` `get; set` -- Gets or sets a value indicating whether to include lowercase alphabet characters in the result.
- [MinLength](/reference/api/csharp/aspire.hosting/generateparameterdefault/properties.md#minlength) : `int` `get; set` -- Gets or sets the minimum length of the generated value.
- [MinLower](/reference/api/csharp/aspire.hosting/generateparameterdefault/properties.md#minlower) : `int` `get; set` -- Gets or sets the minimum number of lowercase characters in the result.
- [MinNumeric](/reference/api/csharp/aspire.hosting/generateparameterdefault/properties.md#minnumeric) : `int` `get; set` -- Gets or sets the minimum number of numeric characters in the result.
- [MinSpecial](/reference/api/csharp/aspire.hosting/generateparameterdefault/properties.md#minspecial) : `int` `get; set` -- Gets or sets the minimum number of special characters in the result.
- [MinUpper](/reference/api/csharp/aspire.hosting/generateparameterdefault/properties.md#minupper) : `int` `get; set` -- Gets or sets the minimum number of uppercase characters in the result.
- [Numeric](/reference/api/csharp/aspire.hosting/generateparameterdefault/properties.md#numeric) : `bool` `get; set` -- Gets or sets a value indicating whether to include numeric characters in the result.
- [Special](/reference/api/csharp/aspire.hosting/generateparameterdefault/properties.md#special) : `bool` `get; set` -- Gets or sets a value indicating whether to include special characters in the result.
- [Upper](/reference/api/csharp/aspire.hosting/generateparameterdefault/properties.md#upper) : `bool` `get; set` -- Gets or sets a value indicating whether to include uppercase alphabet characters in the result.

## Methods

- [GetDefaultValue](/reference/api/csharp/aspire.hosting/generateparameterdefault/methods.md#getdefaultvalue) : `string` -- Generates a value for the parameter.
- [WriteToManifest(ManifestPublishingContext)](/reference/api/csharp/aspire.hosting/generateparameterdefault/methods.md#writetomanifest-manifestpublishingcontext) -- Writes the current [ParameterDefault](/reference/api/csharp/aspire.hosting/parameterdefault.md) to the manifest context.
