-
Notifications
You must be signed in to change notification settings - Fork 9.8k
/
PasswordHasherOptions.cs
38 lines (33 loc) · 1.44 KB
/
PasswordHasherOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Security.Cryptography;
namespace Microsoft.AspNetCore.Identity
{
/// <summary>
/// Specifies options for password hashing.
/// </summary>
public class PasswordHasherOptions
{
private static readonly RandomNumberGenerator _defaultRng = RandomNumberGenerator.Create(); // secure PRNG
/// <summary>
/// Gets or sets the compatibility mode used when hashing passwords. Defaults to 'ASP.NET Identity version 3'.
/// </summary>
/// <value>
/// The compatibility mode used when hashing passwords.
/// </value>
public PasswordHasherCompatibilityMode CompatibilityMode { get; set; } = PasswordHasherCompatibilityMode.IdentityV3;
/// <summary>
/// Gets or sets the number of iterations used when hashing passwords using PBKDF2. Default is 10,000.
/// </summary>
/// <value>
/// The number of iterations used when hashing passwords using PBKDF2.
/// </value>
/// <remarks>
/// This value is only used when the compatibility mode is set to 'V3'.
/// The value must be a positive integer.
/// </remarks>
public int IterationCount { get; set; } = 10000;
// for unit testing
internal RandomNumberGenerator Rng { get; set; } = _defaultRng;
}
}