> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# weak-hash

> A request credential is hashed with MD5 or SHA-1.

## What it flags

A session token, `Authorization` header, API key or other request credential hashed with MD5 or SHA-1: `crypto.createHash('md5' | 'sha1')` (including a stream piped into it) or `crypto.subtle.digest('SHA-1', ...)`, for example `createHash('md5').update(req.cookies.session_token)`. Collisions for both algorithms are practical to compute, so a digest that stands for a credential is not a safe identifier (CWE-328).

Checksums, ETags and cache keys stay quiet: hashing other request data, or storing the digest under a name such as `cacheKey` or `etag`, is not reported. Pagination cursors and anti-forgery tokens are not credentials. Passwords are reported by [`weak-password-hash`](./weak-password-hash.md), and HMACs are not reported.

## How to review or fix

Use SHA-256 or stronger. When the digest is stored to look a credential up later, use HMAC-SHA-256 with a server-side key.

## Configuration

Set the rule to `"off"` in `loadwise.config.json` to drop its findings:

```json theme={null}
{
  "rules": { "weak-hash": "off" }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.