SQL Flow Field Guide

HASHBYTES

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

cryptographic transform or key lookup

What changes

Input
plaintext or ciphertext and a key, certificate or passphrase
Output or change
ciphertext, plaintext, hash, signature check, or key metadata
Return type
varbinary (maximum 8000 bytes)

Syntax at a glance

HASHBYTES ( '<algorithm>', { @input | 'input' } )

Work example

Compute a supported digest for integrity comparison in an existing data workflow.

Use a current approved hash algorithm and never store passwords with HASHBYTES.

Check your work A digest is not encryption and does not protect a low-entropy secret from guessing.

Open Microsoft Learn for full syntax, permissions, and details for your version.