# Interface IPasswordAlgorithm
Namespace: [CapyKit](CapyKit.md)
Assembly: CapyKit.dll
Defines the contract for password encryption algorithms.
```csharp
public interface IPasswordAlgorithm
```
#### Extension Methods
[ObjectExtensions.UpdateProperties\(IPasswordAlgorithm, IPasswordAlgorithm\)](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\_)
## Properties
### AlgorithmName
Gets the name of the algorithm.
```csharp
string AlgorithmName { get; }
```
#### Property Value
[string](https://learn.microsoft.com/dotnet/api/system.string)
## Methods
### Compare\(string, byte\[\], params object\[\]\)
Compares the given plaintext password with an encrypted value using PBKDF2 algorithm.
```csharp
bool Compare(string password, byte[] encryptedValue, params object[] args)
```
#### Parameters
`password` [string](https://learn.microsoft.com/dotnet/api/system.string)
The plaintext password to compare.
`encryptedValue` [byte](https://learn.microsoft.com/dotnet/api/system.byte)\[\]
The encrypted value to compare against.
`args` [object](https://learn.microsoft.com/dotnet/api/system.object)\[\]
Additional arguments for the encryption process, such as salt and length.
#### Returns
[bool](https://learn.microsoft.com/dotnet/api/system.boolean)
True if the given password matches the encryptedValue,
false if they are different.
### Encrypt\(string, params object\[\]\)
Encrypts the given password using a defined algorithm.
```csharp
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, such as salt and length.
#### Returns
[byte](https://learn.microsoft.com/dotnet/api/system.byte)\[\]
A byte array with the hashed password.