Hash functions

**Syntax**

```
wordShingleSimHashUTF8(string[, shinglesize])
```

**Arguments**

- `string` — String for which to compute the hash. [`String`](/docs/sql-reference/data-types/string)
- `shinglesize` — Optional. The size of a word shingle, any number from `1` to `25`. The default value is `3`. [`UInt8`](/docs/sql-reference/data-types/int-uint)

**Returned value**

Returns the computed hash value. [`UInt64`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example**

```
SELECT wordShingleSimHashUTF8('ClickHouse® is a column-oriented database management system (DBMS) for online analytical processing of queries (OLAP).') AS Hash;
```

```
┌───────Hash─┐
│ 2328277067 │
└────────────┘
```

## wyHash64[​](#wyHash64 "Direct link to wyHash64")

Introduced in: v22.7.0

Computes a 64-bit [wyHash64](https://github.com/wangyi-fudan/wyhash) hash value.

**Syntax**

```
wyHash64(arg)
```

**Arguments**

- `arg` — String argument for which to compute the hash. [`String`](/docs/sql-reference/data-types/string)

**Returned value**

Returns the computed 64-bit hash value [`UInt64`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example**

```
SELECT wyHash64('ClickHouse') AS Hash;
```

```
12336419557878201794
```

## xxHash32[​](#xxHash32 "Direct link to xxHash32")

Introduced in: v20.1.0

Calculates a [xxHash](http://cyan4973.github.io/xxHash/) from a string.

For the 64-bit version see [`xxHash64`](#xxHash64)

**Syntax**

```
xxHash32(arg)
```

**Arguments**

- `arg` — Input string to hash. [`String`](/docs/sql-reference/data-types/string)

**Returned value**

Returns the computed 32-bit hash of the input string. [`UInt32`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example**

```
SELECT xxHash32('Hello, world!');
```

```
┌─xxHash32('Hello, world!')─┐
│                 834093149 │
└───────────────────────────┘
```

## xxHash64[​](#xxHash64 "Direct link to xxHash64")

Introduced in: v20.1.0

Calculates a [xxHash](http://cyan4973.github.io/xxHash/) from a string.

For the 32-bit version see [`xxHash32`](#xxHash32)

**Syntax**

```
xxHash64(arg)
```

**Arguments**

- `arg` — Input string to hash. [`String`](/docs/sql-reference/data-types/string)

**Returned value**

Returns the computed 64-bit hash of the input string. [`UInt64`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example**

```
SELECT xxHash64('Hello, world!');
```

```
┌─xxHash64('Hello, world!')─┐
│      17691043854468224118 │
└───────────────────────────┘
```

## xxh3[​](#xxh3 "Direct link to xxh3")

Introduced in: v22.12.0

Computes a [XXH3](https://github.com/Cyan4973/xxHash) 64-bit hash value.

**Syntax**

```
xxh3(expr)
```

**Arguments**

- `expr` — A list of expressions of any data type. [`Any`](/docs/sql-reference/data-types)

**Returned value**

Returns the computed 64-bit `xxh3` hash value [`UInt64`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example**

```
SELECT xxh3('ClickHouse')
```

```
18009318874338624809
```

## xxh3\_128[​](#xxh3_128 "Direct link to xxh3_128")

Introduced in: v26.2.0

Computes a [XXH3](https://github.com/Cyan4973/xxHash) 128-bit hash value.

**Syntax**

```
xxh3_128(expr)
```

**Arguments**

- `expr` — A list of expressions of any data type. [`Any`](/docs/sql-reference/data-types)

**Returned value**

Returns the computed 128-bit `xxh3` hash value [`UInt128`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example**

```
SELECT hex(xxh3_128('ClickHouse'))
```

```
3A038784C52804B4DBA43A038784C528
```

- [BLAKE3](#BLAKE3)- [MD4](#MD4)- [MD5](#MD5)- [RIPEMD160](#RIPEMD160)- [SHA1](#SHA1)- [SHA224](#SHA224)- [SHA256](#SHA256)- [SHA384](#SHA384)- [SHA512](#SHA512)- [SHA512\_256](#SHA512_256)- [URLHash](#URLHash)- [cityHash64](#cityHash64)- [farmFingerprint64](#farmFingerprint64)- [farmHash64](#farmHash64)- [gccMurmurHash](#gccMurmurHash)- [halfMD5](#halfMD5)- [hiveHash](#hiveHash)- [icebergHash](#icebergHash)- [intHash32](#intHash32)- [intHash64](#intHash64)- [javaHash](#javaHash)- [javaHashUTF16LE](#javaHashUTF16LE)- [jumpConsistentHash](#jumpConsistentHash)- [kafkaMurmurHash](#kafkaMurmurHash)- [keccak256](#keccak256)- [kostikConsistentHash](#kostikConsistentHash)- [metroHash64](#metroHash64)- [murmurHash2\_32](#murmurHash2_32)- [murmurHash2\_64](#murmurHash2_64)- [murmurHash3\_128](#murmurHash3_128)- [murmurHash3\_32](#murmurHash3_32)- [murmurHash3\_64](#murmurHash3_64)- [ngramMinHash](#ngramMinHash)- [ngramMinHashArg](#ngramMinHashArg)- [ngramMinHashArgCaseInsensitive](#ngramMinHashArgCaseInsensitive)- [ngramMinHashArgCaseInsensitiveUTF8](#ngramMinHashArgCaseInsensitiveUTF8)- [ngramMinHashArgUTF8](#ngramMinHashArgUTF8)- [ngramMinHashCaseInsensitive](#ngramMinHashCaseInsensitive)- [ngramMinHashCaseInsensitiveUTF8](#ngramMinHashCaseInsensitiveUTF8)- [ngramMinHashUTF8](#ngramMinHashUTF8)- [ngramSimHash](#ngramSimHash)- [ngramSimHashCaseInsensitive](#ngramSimHashCaseInsensitive)- [ngramSimHashCaseInsensitiveUTF8](#ngramSimHashCaseInsensitiveUTF8)- [ngramSimHashUTF8](#ngramSimHashUTF8)- [sipHash128](#sipHash128)- [sipHash128Keyed](#sipHash128Keyed)- [sipHash128Reference](#sipHash128Reference)- [sipHash128ReferenceKeyed](#sipHash128ReferenceKeyed)- [sipHash64](#sipHash64)- [sipHash64Keyed](#sipHash64Keyed)- [wordShingleMinHash](#wordShingleMinHash)- [wordShingleMinHashArg](#wordShingleMinHashArg)- [wordShingleMinHashArgCaseInsensitive](#wordShingleMinHashArgCaseInsensitive)- [wordShingleMinHashArgCaseInsensitiveUTF8](#wordShingleMinHashArgCaseInsensitiveUTF8)- [wordShingleMinHashArgUTF8](#wordShingleMinHashArgUTF8)- [wordShingleMinHashCaseInsensitive](#wordShingleMinHashCaseInsensitive)- [wordShingleMinHashCaseInsensitiveUTF8](#wordShingleMinHashCaseInsensitiveUTF8)- [wordShingleMinHashUTF8](#wordShingleMinHashUTF8)- [wordShingleSimHash](#wordShingleSimHash)- [wordShingleSimHashCaseInsensitive](#wordShingleSimHashCaseInsensitive)- [wordShingleSimHashCaseInsensitiveUTF8](#wordShingleSimHashCaseInsensitiveUTF8)- [wordShingleSimHashUTF8](#wordShingleSimHashUTF8)- [wyHash64](#wyHash64)- [xxHash32](#xxHash32)- [xxHash64](#xxHash64)- [xxh3](#xxh3)- [xxh3\_128](#xxh3_128)

Was this page helpful?