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

# SHA

> Computes the SHA-1 digest of a string or binary value.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

**Aliases:** [`sha1`](/query/sql/functions/hash/sha1)

Returns NULL when an argument is NULL.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
sha(value)
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | STRING or BINARY | Yes | The bytes to hash; strings use their UTF-8 bytes. |

## Returns

* Type: STRING
* Possible values: A 40-character lowercase hexadecimal digest.
* NULL behavior: Returns NULL when an argument is NULL.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Usage notes

* An empty string hashes to da39a3ee5e6b4b0d3255bfef95601890afd80709.

## Examples

### Value and NULL input

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT sha('abc') AS digest, sha(CAST(NULL AS STRING)) AS null_value;
```

| digest | null\_value |
| - | - |
| a9993e364706816aba3e25717850c26c9cd0d89d | NULL |

### Hash empty text

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT sha('') AS digest;
```

| digest |
| - |
| da39a3ee5e6b4b0d3255bfef95601890afd80709 |


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