# md5

[Read this page in HTML](https://www.scopedb.io/docs/reference/functions/string/md5)

Returns the MD5 digest of a string.

## Syntax

```scopeql
md5(<string>)
```

## Arguments

| Argument   | Type     | Description     |
| ---------- | -------- | --------------- |
| `<string>` | `string` | String to hash. |

## Returns

Returns `string` containing 32 lowercase hexadecimal characters. Returns NULL if the input is NULL.

## Examples

Create a content fingerprint for exported records. Identical text receives the same fingerprint.

```scopeql
VALUES
    ('evt-17', 'order=o-17 status=paid'),
    ('evt-18', 'order=o-17 status=paid'),
    ('evt-19', 'order=o-42 status=paid')
SELECT $0 AS event_id, $1 AS record
SELECT event_id, md5(record) AS fingerprint
```

```text
+----------+----------------------------------+
| event_id | fingerprint                      |
+----------+----------------------------------+
| evt-17   | 5b91e13c95e7ccf1863c51b384e54491 |
| evt-18   | 5b91e13c95e7ccf1863c51b384e54491 |
| evt-19   | 99b338711fc1f1c6f6fdf2dc846204a3 |
+----------+----------------------------------+
```

Different JSON formatting produces different hashes even when the values are equivalent. MD5 hashes can also collide; use them as a comparison aid, not a unique record ID.
