121 lines
3.3 KiB
Markdown
121 lines
3.3 KiB
Markdown
# <a id="CapyKit_Pbkdf2Algorithm"></a> Class Pbkdf2Algorithm
|
|
|
|
Namespace: [CapyKit](CapyKit.md)
|
|
Assembly: CapyKit.dll
|
|
|
|
Implements the PBKDF2 algorithm for password encryption.
|
|
|
|
```csharp
|
|
public class Pbkdf2Algorithm : IPasswordAlgorithm
|
|
```
|
|
|
|
#### Inheritance
|
|
|
|
[object](https://learn.microsoft.com/dotnet/api/system.object) ←
|
|
[Pbkdf2Algorithm](CapyKit.Pbkdf2Algorithm.md)
|
|
|
|
#### Implements
|
|
|
|
[IPasswordAlgorithm](CapyKit.IPasswordAlgorithm.md)
|
|
|
|
#### Inherited Members
|
|
|
|
[object.Equals\(object?\)](https://learn.microsoft.com/dotnet/api/system.object.equals\#system\-object\-equals\(system\-object\)),
|
|
[object.Equals\(object?, object?\)](https://learn.microsoft.com/dotnet/api/system.object.equals\#system\-object\-equals\(system\-object\-system\-object\)),
|
|
[object.GetHashCode\(\)](https://learn.microsoft.com/dotnet/api/system.object.gethashcode),
|
|
[object.GetType\(\)](https://learn.microsoft.com/dotnet/api/system.object.gettype),
|
|
[object.MemberwiseClone\(\)](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone),
|
|
[object.ReferenceEquals\(object?, object?\)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals),
|
|
[object.ToString\(\)](https://learn.microsoft.com/dotnet/api/system.object.tostring)
|
|
|
|
#### Extension Methods
|
|
|
|
[ObjectExtensions.UpdateProperties<Pbkdf2Algorithm\>\(Pbkdf2Algorithm, Pbkdf2Algorithm\)](CapyKit.Extensions.ObjectExtensions.md\#CapyKit\_Extensions\_ObjectExtensions\_UpdateProperties\_\_1\_\_\_0\_\_\_0\_),
|
|
[ObjectExtensions.UpdateProperties\(object, object\)](CapyKit.Extensions.ObjectExtensions.md\#CapyKit\_Extensions\_ObjectExtensions\_UpdateProperties\_System\_Object\_System\_Object\_)
|
|
|
|
## Constructors
|
|
|
|
### <a id="CapyKit_Pbkdf2Algorithm__ctor"></a> Pbkdf2Algorithm\(\)
|
|
|
|
Default constructor.
|
|
|
|
```csharp
|
|
public Pbkdf2Algorithm()
|
|
```
|
|
|
|
## Fields
|
|
|
|
### <a id="CapyKit_Pbkdf2Algorithm_ITERATIONS"></a> ITERATIONS
|
|
|
|
The default number of iterations.
|
|
|
|
```csharp
|
|
public const int ITERATIONS = 100000
|
|
```
|
|
|
|
#### Field Value
|
|
|
|
[int](https://learn.microsoft.com/dotnet/api/system.int32)
|
|
|
|
#### Remarks
|
|
|
|
This member is immutable.
|
|
|
|
### <a id="CapyKit_Pbkdf2Algorithm_LENGTH"></a> LENGTH
|
|
|
|
(Immutable) The default length.
|
|
|
|
```csharp
|
|
public const int LENGTH = 32
|
|
```
|
|
|
|
#### Field Value
|
|
|
|
[int](https://learn.microsoft.com/dotnet/api/system.int32)
|
|
|
|
#### Remarks
|
|
|
|
This member is immutable.
|
|
|
|
## Properties
|
|
|
|
### <a id="CapyKit_Pbkdf2Algorithm_AlgorithmName"></a> AlgorithmName
|
|
|
|
Gets the name of the algorithm.
|
|
|
|
```csharp
|
|
public string AlgorithmName { get; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
[string](https://learn.microsoft.com/dotnet/api/system.string)
|
|
|
|
## Methods
|
|
|
|
### <a id="CapyKit_Pbkdf2Algorithm_Encrypt_System_String_System_Object___"></a> Encrypt\(string, params object\[\]\)
|
|
|
|
Encrypts the given password using a PBKDF2 algorithm.
|
|
|
|
```csharp
|
|
public byte[] Encrypt(string password, params object[] args)
|
|
```
|
|
|
|
#### Parameters
|
|
|
|
`password` [string](https://learn.microsoft.com/dotnet/api/system.string)
|
|
|
|
The plaintext password.
|
|
|
|
`args` [object](https://learn.microsoft.com/dotnet/api/system.object)\[\]
|
|
|
|
Additional arguments for the encryption process, specifically
|
|
|
|
<ol><li><code>salt</code></li><li><code>length</code></li><li><code>iterations</code></li></ol>
|
|
|
|
#### Returns
|
|
|
|
[byte](https://learn.microsoft.com/dotnet/api/system.byte)\[\]
|
|
|
|
A byte array with the hashed <code class="paramref">password</code>.
|
|
|