\echo Use "CREATE EXTENSION xxhash" to load this file. \quit


-- functions that return hex text (like md5())

CREATE OR REPLACE FUNCTION xxh32(text) RETURNS varchar(8) AS 'MODULE_PATHNAME', 'pg_xxh32' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION xxh64(text) RETURNS varchar(16) AS 'MODULE_PATHNAME', 'pg_xxh64' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;

CREATE OR REPLACE FUNCTION xxh3_64(text) RETURNS varchar(16) AS 'MODULE_PATHNAME', 'pg_xxh3_64' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION xxh3_128(text) RETURNS varchar(32) AS 'MODULE_PATHNAME', 'pg_xxh3_128' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION xxh128(text) RETURNS varchar(32) AS 'MODULE_PATHNAME', 'pg_xxh3_128' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;  -- alias


-- functions that return bytea (like sha256())

CREATE OR REPLACE FUNCTION xxh32b(text) RETURNS bytea AS 'MODULE_PATHNAME', 'pg_xxh32b' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION xxh64b(text) RETURNS bytea AS 'MODULE_PATHNAME', 'pg_xxh64b' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;

CREATE OR REPLACE FUNCTION xxh3_64b(text) RETURNS bytea AS 'MODULE_PATHNAME', 'pg_xxh3_64b' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION xxh3_128b(text) RETURNS bytea AS 'MODULE_PATHNAME', 'pg_xxh3_128b' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OR REPLACE FUNCTION xxh128b(text) RETURNS bytea AS 'MODULE_PATHNAME', 'pg_xxh3_128b' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;  -- alias
