# 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)
