Skip to content

hashtypes

sha1, md5 and other data types for PostgreSQL

hashtypes · sha1, md5 and other data types for PostgreSQL

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
3770hashtypeshashtypes0.1.5TYPEPostgreSQLC
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d--NoYesNoYesnono

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY0.1.519 18 17 16 15hashtypes-
RPMPIGSTY0.1.519 18 17 16 15hashtypes_$v-
DEBPIGSTY0.1.519 18 17 16 15postgresql-$v-hashtypes-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5
el8.aarch64N/APIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5
el9.x86_64PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5
el9.aarch64PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5
el10.x86_64PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5
el10.aarch64PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5
d12.x86_64PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5
d12.aarch64PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5
d13.x86_64PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5
d13.aarch64PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5
u22.x86_64PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5
u22.aarch64PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5
u24.x86_64PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5
u24.aarch64PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5
u26.x86_64PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5
u26.aarch64PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5PIGSTY 0.1.5
PackageVersionOSORGSIZEFile URL
hashtypes_190.1.5el9.x86_64pigsty45.1 KiBhashtypes_19-0.1.5-1PGSTY.el9.x86_64.rpm
hashtypes_190.1.5el9.aarch64pigsty44.4 KiBhashtypes_19-0.1.5-1PGSTY.el9.aarch64.rpm
hashtypes_190.1.5el10.x86_64pigsty44.9 KiBhashtypes_19-0.1.5-1PGSTY.el10.x86_64.rpm
hashtypes_190.1.5el10.aarch64pigsty45.0 KiBhashtypes_19-0.1.5-1PGSTY.el10.aarch64.rpm
postgresql-19-hashtypes0.1.5d12.x86_64pigsty33.6 KiBpostgresql-19-hashtypes_0.1.5-1PGSTY~bookworm_amd64.deb
postgresql-19-hashtypes0.1.5d12.aarch64pigsty33.6 KiBpostgresql-19-hashtypes_0.1.5-1PGSTY~bookworm_arm64.deb
postgresql-19-hashtypes0.1.5d13.x86_64pigsty33.7 KiBpostgresql-19-hashtypes_0.1.5-1PGSTY~trixie_amd64.deb
postgresql-19-hashtypes0.1.5d13.aarch64pigsty33.7 KiBpostgresql-19-hashtypes_0.1.5-1PGSTY~trixie_arm64.deb
postgresql-19-hashtypes0.1.5u22.x86_64pigsty35.9 KiBpostgresql-19-hashtypes_0.1.5-1PGSTY~jammy_amd64.deb
postgresql-19-hashtypes0.1.5u22.aarch64pigsty35.4 KiBpostgresql-19-hashtypes_0.1.5-1PGSTY~jammy_arm64.deb
postgresql-19-hashtypes0.1.5u24.x86_64pigsty35.1 KiBpostgresql-19-hashtypes_0.1.5-1PGSTY~noble_amd64.deb
postgresql-19-hashtypes0.1.5u24.aarch64pigsty35.3 KiBpostgresql-19-hashtypes_0.1.5-1PGSTY~noble_arm64.deb
postgresql-19-hashtypes0.1.5u26.x86_64pigsty35.0 KiBpostgresql-19-hashtypes_0.1.5-1PGSTY~resolute_amd64.deb
postgresql-19-hashtypes0.1.5u26.aarch64pigsty35.2 KiBpostgresql-19-hashtypes_0.1.5-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
hashtypes_180.1.5el8.x86_64pigsty44.0 KiBhashtypes_18-0.1.5-1PGSTY.el8.x86_64.rpm
hashtypes_180.1.5el8.aarch64pigsty43.8 KiBhashtypes_18-0.1.5-1PGSTY.el8.aarch64.rpm
hashtypes_180.1.5el9.x86_64pigsty45.0 KiBhashtypes_18-0.1.5-1PGSTY.el9.x86_64.rpm
hashtypes_180.1.5el9.aarch64pigsty44.4 KiBhashtypes_18-0.1.5-1PGSTY.el9.aarch64.rpm
hashtypes_180.1.5el10.x86_64pigsty44.9 KiBhashtypes_18-0.1.5-1PGSTY.el10.x86_64.rpm
hashtypes_180.1.5el10.aarch64pigsty45.0 KiBhashtypes_18-0.1.5-1PGSTY.el10.aarch64.rpm
postgresql-18-hashtypes0.1.5d12.x86_64pigsty33.7 KiBpostgresql-18-hashtypes_0.1.5-1PGSTY~bookworm_amd64.deb
postgresql-18-hashtypes0.1.5d12.aarch64pigsty33.6 KiBpostgresql-18-hashtypes_0.1.5-1PGSTY~bookworm_arm64.deb
postgresql-18-hashtypes0.1.5d13.x86_64pigsty33.7 KiBpostgresql-18-hashtypes_0.1.5-1PGSTY~trixie_amd64.deb
postgresql-18-hashtypes0.1.5d13.aarch64pigsty33.8 KiBpostgresql-18-hashtypes_0.1.5-1PGSTY~trixie_arm64.deb
postgresql-18-hashtypes0.1.5u22.x86_64pigsty35.9 KiBpostgresql-18-hashtypes_0.1.5-1PGSTY~jammy_amd64.deb
postgresql-18-hashtypes0.1.5u22.aarch64pigsty35.4 KiBpostgresql-18-hashtypes_0.1.5-1PGSTY~jammy_arm64.deb
postgresql-18-hashtypes0.1.5u24.x86_64pigsty35.2 KiBpostgresql-18-hashtypes_0.1.5-1PGSTY~noble_amd64.deb
postgresql-18-hashtypes0.1.5u24.aarch64pigsty35.2 KiBpostgresql-18-hashtypes_0.1.5-1PGSTY~noble_arm64.deb
postgresql-18-hashtypes0.1.5u26.x86_64pigsty35.0 KiBpostgresql-18-hashtypes_0.1.5-1PGSTY~resolute_amd64.deb
postgresql-18-hashtypes0.1.5u26.aarch64pigsty35.2 KiBpostgresql-18-hashtypes_0.1.5-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
hashtypes_170.1.5el8.x86_64pigsty44.0 KiBhashtypes_17-0.1.5-1PGSTY.el8.x86_64.rpm
hashtypes_170.1.5el8.aarch64pigsty43.8 KiBhashtypes_17-0.1.5-1PGSTY.el8.aarch64.rpm
hashtypes_170.1.5el9.x86_64pigsty45.0 KiBhashtypes_17-0.1.5-1PGSTY.el9.x86_64.rpm
hashtypes_170.1.5el9.aarch64pigsty44.4 KiBhashtypes_17-0.1.5-1PGSTY.el9.aarch64.rpm
hashtypes_170.1.5el10.x86_64pigsty44.9 KiBhashtypes_17-0.1.5-1PGSTY.el10.x86_64.rpm
hashtypes_170.1.5el10.aarch64pigsty45.0 KiBhashtypes_17-0.1.5-1PGSTY.el10.aarch64.rpm
postgresql-17-hashtypes0.1.5d12.x86_64pigsty33.7 KiBpostgresql-17-hashtypes_0.1.5-1PGSTY~bookworm_amd64.deb
postgresql-17-hashtypes0.1.5d12.aarch64pigsty33.6 KiBpostgresql-17-hashtypes_0.1.5-1PGSTY~bookworm_arm64.deb
postgresql-17-hashtypes0.1.5d13.x86_64pigsty33.7 KiBpostgresql-17-hashtypes_0.1.5-1PGSTY~trixie_amd64.deb
postgresql-17-hashtypes0.1.5d13.aarch64pigsty33.7 KiBpostgresql-17-hashtypes_0.1.5-1PGSTY~trixie_arm64.deb
postgresql-17-hashtypes0.1.5u22.x86_64pigsty36.5 KiBpostgresql-17-hashtypes_0.1.5-1PGSTY~jammy_amd64.deb
postgresql-17-hashtypes0.1.5u22.aarch64pigsty36.0 KiBpostgresql-17-hashtypes_0.1.5-1PGSTY~jammy_arm64.deb
postgresql-17-hashtypes0.1.5u24.x86_64pigsty35.1 KiBpostgresql-17-hashtypes_0.1.5-1PGSTY~noble_amd64.deb
postgresql-17-hashtypes0.1.5u24.aarch64pigsty35.2 KiBpostgresql-17-hashtypes_0.1.5-1PGSTY~noble_arm64.deb
postgresql-17-hashtypes0.1.5u26.x86_64pigsty35.0 KiBpostgresql-17-hashtypes_0.1.5-1PGSTY~resolute_amd64.deb
postgresql-17-hashtypes0.1.5u26.aarch64pigsty35.2 KiBpostgresql-17-hashtypes_0.1.5-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
hashtypes_160.1.5el8.x86_64pigsty44.0 KiBhashtypes_16-0.1.5-1PGSTY.el8.x86_64.rpm
hashtypes_160.1.5el8.aarch64pigsty43.8 KiBhashtypes_16-0.1.5-1PGSTY.el8.aarch64.rpm
hashtypes_160.1.5el9.x86_64pigsty45.0 KiBhashtypes_16-0.1.5-1PGSTY.el9.x86_64.rpm
hashtypes_160.1.5el9.aarch64pigsty44.4 KiBhashtypes_16-0.1.5-1PGSTY.el9.aarch64.rpm
hashtypes_160.1.5el10.x86_64pigsty44.9 KiBhashtypes_16-0.1.5-1PGSTY.el10.x86_64.rpm
hashtypes_160.1.5el10.aarch64pigsty45.0 KiBhashtypes_16-0.1.5-1PGSTY.el10.aarch64.rpm
postgresql-16-hashtypes0.1.5d12.x86_64pigsty33.6 KiBpostgresql-16-hashtypes_0.1.5-1PGSTY~bookworm_amd64.deb
postgresql-16-hashtypes0.1.5d12.aarch64pigsty33.6 KiBpostgresql-16-hashtypes_0.1.5-1PGSTY~bookworm_arm64.deb
postgresql-16-hashtypes0.1.5d13.x86_64pigsty33.7 KiBpostgresql-16-hashtypes_0.1.5-1PGSTY~trixie_amd64.deb
postgresql-16-hashtypes0.1.5d13.aarch64pigsty33.8 KiBpostgresql-16-hashtypes_0.1.5-1PGSTY~trixie_arm64.deb
postgresql-16-hashtypes0.1.5u22.x86_64pigsty36.5 KiBpostgresql-16-hashtypes_0.1.5-1PGSTY~jammy_amd64.deb
postgresql-16-hashtypes0.1.5u22.aarch64pigsty36.0 KiBpostgresql-16-hashtypes_0.1.5-1PGSTY~jammy_arm64.deb
postgresql-16-hashtypes0.1.5u24.x86_64pigsty35.2 KiBpostgresql-16-hashtypes_0.1.5-1PGSTY~noble_amd64.deb
postgresql-16-hashtypes0.1.5u24.aarch64pigsty35.2 KiBpostgresql-16-hashtypes_0.1.5-1PGSTY~noble_arm64.deb
postgresql-16-hashtypes0.1.5u26.x86_64pigsty35.0 KiBpostgresql-16-hashtypes_0.1.5-1PGSTY~resolute_amd64.deb
postgresql-16-hashtypes0.1.5u26.aarch64pigsty35.2 KiBpostgresql-16-hashtypes_0.1.5-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
hashtypes_150.1.5el8.x86_64pigsty44.1 KiBhashtypes_15-0.1.5-1PGSTY.el8.x86_64.rpm
hashtypes_150.1.5el8.aarch64pigsty44.1 KiBhashtypes_15-0.1.5-1PGSTY.el8.aarch64.rpm
hashtypes_150.1.5el9.x86_64pigsty45.0 KiBhashtypes_15-0.1.5-1PGSTY.el9.x86_64.rpm
hashtypes_150.1.5el9.aarch64pigsty44.7 KiBhashtypes_15-0.1.5-1PGSTY.el9.aarch64.rpm
hashtypes_150.1.5el10.x86_64pigsty44.9 KiBhashtypes_15-0.1.5-1PGSTY.el10.x86_64.rpm
hashtypes_150.1.5el10.aarch64pigsty45.0 KiBhashtypes_15-0.1.5-1PGSTY.el10.aarch64.rpm
postgresql-15-hashtypes0.1.5d12.x86_64pigsty33.7 KiBpostgresql-15-hashtypes_0.1.5-1PGSTY~bookworm_amd64.deb
postgresql-15-hashtypes0.1.5d12.aarch64pigsty33.6 KiBpostgresql-15-hashtypes_0.1.5-1PGSTY~bookworm_arm64.deb
postgresql-15-hashtypes0.1.5d13.x86_64pigsty33.8 KiBpostgresql-15-hashtypes_0.1.5-1PGSTY~trixie_amd64.deb
postgresql-15-hashtypes0.1.5d13.aarch64pigsty33.6 KiBpostgresql-15-hashtypes_0.1.5-1PGSTY~trixie_arm64.deb
postgresql-15-hashtypes0.1.5u22.x86_64pigsty36.9 KiBpostgresql-15-hashtypes_0.1.5-1PGSTY~jammy_amd64.deb
postgresql-15-hashtypes0.1.5u22.aarch64pigsty36.2 KiBpostgresql-15-hashtypes_0.1.5-1PGSTY~jammy_arm64.deb
postgresql-15-hashtypes0.1.5u24.x86_64pigsty35.2 KiBpostgresql-15-hashtypes_0.1.5-1PGSTY~noble_amd64.deb
postgresql-15-hashtypes0.1.5u24.aarch64pigsty35.1 KiBpostgresql-15-hashtypes_0.1.5-1PGSTY~noble_arm64.deb
postgresql-15-hashtypes0.1.5u26.x86_64pigsty34.9 KiBpostgresql-15-hashtypes_0.1.5-1PGSTY~resolute_amd64.deb
postgresql-15-hashtypes0.1.5u26.aarch64pigsty35.2 KiBpostgresql-15-hashtypes_0.1.5-1PGSTY~resolute_arm64.deb

Source

pig build pkg hashtypes;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install hashtypes;		# install by package name

pig install hashtypes -v 19;   # install for PG 19
pig install hashtypes -v 18;   # install for PG 18
pig install hashtypes -v 17;   # install for PG 17
pig install hashtypes -v 16;   # install for PG 16
pig install hashtypes -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION hashtypes;

Usage

hashtypes: hash and checksum data types (SHA, CRC32)

The hashtypes extension provides native data types for storing hash values and checksums in their binary representation, saving storage compared to text.

CREATE EXTENSION hashtypes;

Data Types

TypeStorageDescription
sha120 bytesSHA-1 hash (160-bit)
sha22428 bytesSHA-224 hash (224-bit)
sha25632 bytesSHA-256 hash (256-bit)
sha38448 bytesSHA-384 hash (384-bit)
sha51264 bytesSHA-512 hash (512-bit)
crc324 bytesCRC-32 checksum

Usage

CREATE TABLE objects (
    hash sha256 PRIMARY KEY,
    data bytea
);

INSERT INTO objects VALUES (
    'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
    '\x'
);

SELECT * FROM objects WHERE hash = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855';

Operators

All types support comparison operators: =, <>, <, >, <=, >=.

Index Support

Btree and hash index operator classes are provided for all types.

Casts

All types support bidirectional casts to/from text and bytea.

Table reader