CapyKit/Documentation/Help/M_CapyKit_Helpers_SecurityHelper_CompareHashedPassword__1.md

50 lines
2 KiB
Markdown
Raw Normal View History

2024-06-24 01:17:33 -05:00
# CompareHashedPassword<T>(Password, String, Byte[], Object[]) Method
Compares an unencrypted *password* with a stored, encrypted *existingPassword*. This method uses the specified password algorithm type *T* to retrieve the hashed version of the *password* and then compares it with the *existingPassword*.
## Definition
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.0
**C#**
``` C#
public static bool CompareHashedPassword<T>(
Password existingPassword,
string password,
byte[] salt,
params Object[] args
)
```
**F#**
``` F#
static member CompareHashedPassword :
existingPassword : Password *
password : string *
salt : byte[] *
args : Object[] -> bool
```
#### Parameters
<dl><dt>  <a href="T_CapyKit_Password.md">Password</a></dt><dd>The existing, encrypted password.</dd><dt>  <a href="https://learn.microsoft.com/dotnet/api/system.string" target="_blank" rel="noopener noreferrer">String</a></dt><dd>The unencrypted password to be compared.</dd><dt>  <a href="https://learn.microsoft.com/dotnet/api/system.byte" target="_blank" rel="noopener noreferrer">Byte</a>[]</dt><dd>The salt value used in password hashing.</dd><dt>  <a href="https://learn.microsoft.com/dotnet/api/system.object" target="_blank" rel="noopener noreferrer">Object</a>[]</dt><dd>Additional arguments required for constructing the password algorithm instance.</dd></dl>
#### Type Parameters
<dl><dt /><dd>The type of the password hashing algorithm.</dd></dl>
#### Return Value
<a href="https://learn.microsoft.com/dotnet/api/system.boolean" target="_blank" rel="noopener noreferrer">Boolean</a>
true if hash comparison succeeds, false if it fails.
## See Also
#### Reference
<a href="T_CapyKit_Helpers_SecurityHelper.md">SecurityHelper Class</a>
<a href="Overload_CapyKit_Helpers_SecurityHelper_CompareHashedPassword.md">CompareHashedPassword Overload</a>
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>