# SHA512()

Converts a string to a 512-bit hexadecimal SHA-2 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

```
SHA512(stringToConvert, charSet)
```

The `SHA512()` 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.

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

The function outputs a SHA-2 hash of the provided string: `495a8104eef74ae73518705a8227555b596958343b4506860f1925a9cd7056e25473306a9d5ab841147d41cb7476dd965ab37f21bd379d625d42b40f18ef3356`

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

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

The function outputs a SHA-2 hash that uses UTF-16 encoding: `82fdb746ae8cc9a50b4da8e92706e41ef9d242a66c3d40a2a698124583f81769f35226679edbd2fa05c900a6c9ab8337b31f8fcc6f9f9cdfa56001899f758d8a`
