---
schema_version: "1"
id: 1a4137b71c313da9550a564389e79ed3d45f72be7d44f430bfe0488dde9d5d65
title: SHA256
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-query-guide/references/data-cloud-sql-reference/scalar-func/string-func/sha256.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/sha256.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: fb5b74a9211f96f277407327e7bbd46d73b9e156e162986e79f896330a875082
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# `SHA256`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Calculates the SHA-256 hash of data, returning the result as binary data.

## Syntax

```sql
sha256(<data>)
```

## Arguments

### Required

- `<data>`: The text or bytea data to hash.

## Returns

Returns a bytea that contains the SHA-256 hash.

## Considerations

- SHA-256 is cryptographically secure.
- Use `encode(sha256(<data>), 'hex')` for human-readable hexadecimal output.

## Examples

### Calculate SHA-256 Hash

Get the SHA-256 hash of a string.

```sql
SELECT sha256('abc') AS result;
```

Returns `\xba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad`.

## Related Documentation

- [String Types](https://developer.salesforce.com/docs/data/data-cloud-query-guide/datatype/string.md)
