# PBKDF2

### What is PBKDF2?

PBKDF2 is a cryptographic algorithm which stands for Password Based Key Derivation Function.

PBKDF2 applies a pseudo-random function like HMAC-SHA-256 to the input password along with a  salt that repeats the process many times to produce a derived key. &#x20;

Instead of storing the raw password, developer use pbkdf2 to transform that password into a long , complex cryptographic key. It's **primary** job is to make **brute-force attacks slow** for an attacke&#x72;**.**

### How PBKDF2 works?

We need 5 input:

1. Password - Plain text string like 'password123'
2. Salt - A random string to the password so the different user with the same password can have different keys.
3. Iteration - Number of iteration, for how many times you want hashing process to be.
4. Pseudo-Random Function (PRF) - Usually HMAC-SHA256 or HMAC-SHA512
5. Derived Key Length (dkLength) - How long you want final key to be. &#x20;

```
sha256:600000:u/+LBBOUnac=:YshQbDDqCAzy21EdK5OfZBJD1Ne4rXa1VgP5CzLd8Ps=
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kaizoku.gitbook.io/notes/encryption-and-algorithm/pbkdf2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
