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

# String: Hash

> Hashes a string with the provided algorithm, the output can be a string or binary.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Hashes a string with the provided algorithm, the output can be a string or binary. A hash is a fixed-length scrambled code derived from the value: the same input always produces the same hash, but the original value cannot be read back from it. Use this to create a stable, anonymised identifier from a value, to compare two values without storing the originals, or, with a secret key, to produce a signature another system can verify.

This documentation describes: [Schema](/schemas/mapper/string-hash)

## Fields

<FormField property="algo" label="Hash algorithm" required>
  The method used to scramble the value. Each method produces a hash of a fixed length and style, so both sides of an integration must agree on the same one. Defaults to `md5`. A wide range is available, from common choices such as `md5`, `sha1` and `sha256` through to stronger options like `sha512` and `sha3-512`, as well as checksum-style options such as `crc32b`.
</FormField>

<FormField property="binary" label="Return binary data instead of lowercase hexits">
  By default the hash comes back as readable text made of lowercase letters and digits. Turn this on to return the raw binary form instead, which is shorter but not human-readable. Leave it off unless the receiving system specifically expects binary. Off by default.
</FormField>

<FormField property="useHmac" label="Use HMAC key">
  Turn this on to sign the value with a secret key as well, producing a keyed hash (HMAC). Use this when another system needs to verify that the value really came from you and was not tampered with. When off, a plain hash of the value is produced. Off by default.
</FormField>

<FormField property="hmacKey" label="HMAC key" required>
  Only shown when Use HMAC key is on. The secret key used to sign the value; both sides must use the exact same key for the signature to match. This field accepts environment variables, so you can keep the key out of the configuration itself.
</FormField>

## Sample data

| Field                                          | Value    |
| ---------------------------------------------- | -------- |
| Hash algorithm                                 | `sha256` |
| Return binary data instead of lowercase hexits | off      |
| Use HMAC key                                   | off      |

Input:

```json theme={null}
{ "email": "jane.doe@example.com" }
```

Output:

```json theme={null}
{ "email": "86e0b9e56c17cc4d12387e1949b85053fbe73bc3ce5a1188713a9d300cc6133d" }
```

```json Configuration theme={null}
{
  "prototype": "string-hash",
  "parameters": {
    "algo": "sha256",
    "binary": false,
    "useHmac": false
  }
}
```
