CapyKit/Docs/api/CapyKit.IPasswordAlgorithm.md

2.5 KiB

Interface IPasswordAlgorithm

Namespace: CapyKit
Assembly: CapyKit.dll

Defines the contract for password encryption algorithms.

public interface IPasswordAlgorithm

Extension Methods

ObjectExtensions.UpdateProperties<IPasswordAlgorithm>(IPasswordAlgorithm, IPasswordAlgorithm), ObjectExtensions.UpdateProperties(object, object)

Properties

AlgorithmName

Gets the name of the algorithm.

string AlgorithmName { get; }

Property Value

string

Methods

Compare(string, byte[], params object[])

Compares the given plaintext password with an encrypted value using PBKDF2 algorithm.

bool Compare(string password, byte[] encryptedValue, params object[] args)

Parameters

password string

The plaintext password to compare.

encryptedValue byte[]

The encrypted value to compare against.

args object[]

Additional arguments for the encryption process, such as salt and length.

Returns

bool

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.

byte[] Encrypt(string password, params object[] args)

Parameters

password string

The plaintext password.

args object[]

Additional arguments for the encryption process, such as salt and length.

Returns

byte[]

A byte array with the hashed password.