> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/encryption-hashing-and-compression-functions/sha1.md).

# SHA1

## Syntax

```bnf
SHA1(str), SHA(str)
```

## Description

Calculates an SHA-1 160-bit checksum for the string *`str`*, as described in RFC 3174 (Secure Hash Algorithm).

The value is returned as a string of 40 hex digits, or `NULL` if the argument was NULL. The return value is a nonbinary string in the connection [character set and collation](/docs/server/reference/data-types/string-data-types/character-sets.md), determined by the values of the [character\_set\_connection](/docs/server/server-management/variables-and-modes/server-system-variables.md#character_set_connection) and [collation\_connection](/docs/server/server-management/variables-and-modes/server-system-variables.md#collation_connection) system variables.

## Examples

```sql
SELECT SHA1('some boring text');
+------------------------------------------+
| SHA1('some boring text')                 |
+------------------------------------------+
| af969fc2085b1bb6d31e517d5c456def5cdd7093 |
+------------------------------------------+
```

<sub>*This page is licensed: GPLv2, originally from*</sub> [<sub>*fill\_help\_tables.sql*</sub>](https://github.com/MariaDB/server/blob/main/scripts/fill_help_tables.sql)

{% @marketo/form formId="4316" %}
