hashtypes

hashtypes

hashtypes : sha1, md5 and other data types for PostgreSQL

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
3750
hashtypes
hashtypes
0.1.5
TYPE
PostgreSQL
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d--
No
Yes
No
Yes
no
no
Relationships
See Also
prefix
semver
unit
pgpdf
pglite_fusion
md5hash
asn1oid
roaringbitmap

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PIGSTY
0.1.5
18
17
16
15
14
hashtypes-
RPM
PIGSTY
0.1.5
18
17
16
15
14
hashtypes_$v-
DEB
PIGSTY
0.1.5
18
17
16
15
14
postgresql-$v-hashtypes-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
el8.aarch64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
el9.x86_64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
el9.aarch64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
el10.x86_64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
el10.aarch64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
d12.x86_64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
d12.aarch64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
d13.x86_64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
d13.aarch64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
u22.x86_64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
u22.aarch64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
u24.x86_64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
u24.aarch64
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5
PIGSTY 0.1.5

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 via package name, for the active PG version

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
pig install hashtypes -v 14;   # install for PG 14

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.

Last updated on