hashlib
Stable hash functions for Postgres
Repository
markokr/pghashlib
https://github.com/markokr/pghashlib
Source
pg_hashlib-1.1.tar.gz
pg_hashlib-1.1.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_hashlib | 1.1 | UTIL | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4400 | hashlib | No | Yes | No | Yes | No | Yes | - |
build-deps: python3-docutils
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.1 | 1817161514 | pg_hashlib | - |
| RPM | PIGSTY | 1.1 | 1817161514 | pg_hashlib_$v | - |
| DEB | PIGSTY | 1.1 | 1817161514 | postgresql-$v-pg-hashlib | - |
Build
You can build the RPM / DEB packages for pg_hashlib using pig build:
Install
You can install pg_hashlib directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Create Extension:
Usage
Provides stable hash functions whose implementations do not change across PostgreSQL versions.
String Hashing (32-bit)
With optional initial value:
String Hashing (64-bit)
String Hashing (128-bit)
Integer Hashing
Available Algorithms
| Algorithm | CPU-indep | Bits | Description |
|---|---|---|---|
crc32 | yes | 32 | CRC32 |
murmur3 | no | 32 | MurmurHash v3 |
md5 | yes | 128 | MD5 |
city64 | no | 64 | CityHash64 |
city128 | no | 128 | CityHash128 |
siphash24 | yes | 64 | SipHash-2-4 |
spooky | no | 128 | SpookyHash |
lookup2 | no | 64 | Jenkins lookup2 |
lookup3 | no | 64 | Jenkins lookup3 CPU-native |
lookup3be | yes | 64 | Jenkins lookup3 big-endian |
lookup3le | yes | 64 | Jenkins lookup3 little-endian |
pgsql84 | no | 64 | Hacked lookup3 in Postgres 8.4+ |
Integer algorithms: wang32, wang32mult, jenkins (32-bit); wang64, wang64to32 (64-bit). All are reversible (1:1 mapping), useful for creating random sort orders over unique IDs.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)