SHA1
All functions > STRING > SHA1
Returns the SHA-1 hash of a string as a 40-character hexadecimal string.
Signatures
Returns: 40-character lowercase hexadecimal SHA-1 hash
SHA1(string: VARCHAR) → VARCHAR sql
| Parameter | Type | Required | Description |
|---|---|---|---|
string | VARCHAR | Yes | String to hash |
Notes
- Returns a 160-bit hash as a 40-character lowercase hex string
- Deterministic: same input always produces the same hash
- Not available on DataFusion
- Not suitable for security-sensitive applications; use SHA256 instead
- Returns NULL if the input is NULL
Examples
FeatureQL
SELECT
f1 := SHA1('ABC'), -- Hash of uppercase string
f2 := SHA1('hello'), -- Hash of lowercase string
f3 := SHA1('') -- Hash of empty string
;Result
| f1 VARCHAR | f2 VARCHAR | f3 VARCHAR |
|---|---|---|
| 3c01bdbb26f358bab27f267924aa2c9a03fcfdb8 | aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d | da39a3ee5e6b4b0d3255bfef95601890afd80709 |
On this page