# verifyHash()

The verifyHash function is vital for hash verification or decryption, playing a central role in data integrity and security.

> Here is the example of decrypting a password:
>
> ```typescript
> import { createBackendFunction, data, utils } from "@magicjs.dev/backend";
>
> export default createBackendFunction(async function (username, password) {
>     const mongoCollection = data('collectionName');
>     const user = await mongoCollection.findOne({ username });
>
>     if (utils.verifyHash(password, user.password) === false) {
>         // Checking whether the actual password and the user-entered password match.
>         throw new Error(`Password is incorrect`);
>     } else {
>         return "Login succeeded!";
>     }
> });
> ```

[Click here to refer GitHub.](https://github.com/skyslit/magicjs.dev/blob/main/packages/backend/src/utils.ts#L17)


---

# 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://skyslit.gitbook.io/magicjs/api-references/backend/utils/verifyhash.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.
