179 lines
4.9 KiB
Markdown
179 lines
4.9 KiB
Markdown
# <a id="CapyKit_Password"></a> Class Password
|
|
|
|
Namespace: [CapyKit](CapyKit.md)
|
|
Assembly: CapyKit.dll
|
|
|
|
Represents a password with its hash, salt and algorithm used for encryption.
|
|
|
|
```csharp
|
|
public class Password
|
|
```
|
|
|
|
#### Inheritance
|
|
|
|
[object](https://learn.microsoft.com/dotnet/api/system.object) ←
|
|
[Password](CapyKit.Password.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<Password\>\(Password, Password\)](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_Password__ctor_System_String_System_Byte___CapyKit_IPasswordAlgorithm_System_Object___"></a> Password\(string, byte\[\], IPasswordAlgorithm, params object\[\]\)
|
|
|
|
Constructor.
|
|
|
|
```csharp
|
|
public Password(string password, byte[] salt, IPasswordAlgorithm algorithm, params object[] args)
|
|
```
|
|
|
|
#### Parameters
|
|
|
|
`password` [string](https://learn.microsoft.com/dotnet/api/system.string)
|
|
|
|
The password to be hashed.
|
|
|
|
`salt` [byte](https://learn.microsoft.com/dotnet/api/system.byte)\[\]
|
|
|
|
The salt used for encryption.
|
|
|
|
`algorithm` [IPasswordAlgorithm](CapyKit.IPasswordAlgorithm.md)
|
|
|
|
The algorithm used for password encryption.
|
|
|
|
`args` [object](https://learn.microsoft.com/dotnet/api/system.object)\[\]
|
|
|
|
A variable-length parameters list containing arguments to include for the <code class="paramref">algorithm</code>.
|
|
|
|
## Properties
|
|
|
|
### <a id="CapyKit_Password_Algorithm"></a> Algorithm
|
|
|
|
Gets or sets the algorithm used for password encryption.
|
|
|
|
```csharp
|
|
public IPasswordAlgorithm Algorithm { get; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
[IPasswordAlgorithm](CapyKit.IPasswordAlgorithm.md)
|
|
|
|
### <a id="CapyKit_Password_Hash"></a> Hash
|
|
|
|
Gets or sets the hash of the password.
|
|
|
|
```csharp
|
|
public byte[] Hash { get; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
[byte](https://learn.microsoft.com/dotnet/api/system.byte)\[\]
|
|
|
|
### <a id="CapyKit_Password_Pbkdf2Algorithm"></a> Pbkdf2Algorithm
|
|
|
|
Gets the preconfigured PBKDF2 algorithm.
|
|
|
|
```csharp
|
|
public static Pbkdf2Algorithm Pbkdf2Algorithm { get; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
[Pbkdf2Algorithm](CapyKit.Pbkdf2Algorithm.md)
|
|
|
|
### <a id="CapyKit_Password_Salt"></a> Salt
|
|
|
|
Gets or sets the salt used for encryption.
|
|
|
|
```csharp
|
|
public byte[] Salt { get; }
|
|
```
|
|
|
|
#### Property Value
|
|
|
|
[byte](https://learn.microsoft.com/dotnet/api/system.byte)\[\]
|
|
|
|
## Methods
|
|
|
|
### <a id="CapyKit_Password_Equals_System_Object_"></a> Equals\(object?\)
|
|
|
|
Determines whether the specified object is equal to the current object.
|
|
|
|
```csharp
|
|
public override bool Equals(object? obj)
|
|
```
|
|
|
|
#### Parameters
|
|
|
|
`obj` [object](https://learn.microsoft.com/dotnet/api/system.object)?
|
|
|
|
The object to compare with the current object.
|
|
|
|
#### Returns
|
|
|
|
[bool](https://learn.microsoft.com/dotnet/api/system.boolean)
|
|
|
|
<a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a> if the specified object is equal to the current object; otherwise, <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a>.
|
|
|
|
### <a id="CapyKit_Password_ToString"></a> ToString\(\)
|
|
|
|
Returns a string that represents the current object.
|
|
|
|
```csharp
|
|
public override string ToString()
|
|
```
|
|
|
|
#### Returns
|
|
|
|
[string](https://learn.microsoft.com/dotnet/api/system.string)
|
|
|
|
A string that represents the current object.
|
|
|
|
## Operators
|
|
|
|
### <a id="CapyKit_Password_op_Equality_CapyKit_Password_CapyKit_Password_"></a> operator ==\(Password, Password\)
|
|
|
|
```csharp
|
|
public static bool operator ==(Password a, Password b)
|
|
```
|
|
|
|
#### Parameters
|
|
|
|
`a` [Password](CapyKit.Password.md)
|
|
|
|
`b` [Password](CapyKit.Password.md)
|
|
|
|
#### Returns
|
|
|
|
[bool](https://learn.microsoft.com/dotnet/api/system.boolean)
|
|
|
|
### <a id="CapyKit_Password_op_Inequality_CapyKit_Password_CapyKit_Password_"></a> operator \!=\(Password, Password\)
|
|
|
|
```csharp
|
|
public static bool operator !=(Password a, Password b)
|
|
```
|
|
|
|
#### Parameters
|
|
|
|
`a` [Password](CapyKit.Password.md)
|
|
|
|
`b` [Password](CapyKit.Password.md)
|
|
|
|
#### Returns
|
|
|
|
[bool](https://learn.microsoft.com/dotnet/api/system.boolean)
|
|
|