# SHA1()

Converts a string to a 160-bit hexadecimal SHA-1 hash.

## Availability

<table>
  <tr>
    <td>Marketing Cloud Engagement</td>
    <td>✅ Yes</td>
  </tr>
  <tr>
    <td>Marketing Cloud Next</td>
    <td>✅ Yes</td>
  </tr>
</table>

## Syntax

```
SHA1(stringToConvert, charSet)
```

The `SHA1()` function has two parameters:

- `stringToConvert` (string): Required. The string to encode.
- `charSet` (string): The character set to use for encoding. Accepted values are `UTF-8` and `UTF-16`. The default value is `UTF-8`.

## Usage

To use this function, pass it a string.

```
%%=SHA1("This is a string of text.")=%%
```

The function outputs an SHA-1 hash of the provided string: `0af2f4853cc89dc1e1efe397ca334ce7a19d14da`

You can also generate the hash using UTF-16 encoding, as in this example.

```
%%=SHA1("This is a string of text.", "UTF-16")=%%
```

The function outputs an SHA-1 hash that uses UTF-16 encoding: `1a36453a2f2c1bf17dcc763321e5e35268e5e4c6`
