---
schema_version: "1"
id: 44e5f8f61b2e5a99c454779a81ede1594be2ea0b053ee8d220e9a8546f2e6ccc
title: SHA1()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/ampscript/references/encryption/mc-ampscript-reference-encryption-sha1.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-encryption/mc-ampscript-reference-encryption-sha1.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: e94f357eb47e57c81e5ced5f6cc22f2a5e89b8456b82a1362bf9b369fc793747
products:
  - AMPscript for Marketing Cloud
  - Marketing Cloud
---
# 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`
