Skip to content

Instantly share code, notes, and snippets.

@davidfetter
davidfetter / djb2.sql
Last active December 26, 2015 03:49 — forked from BYK/djb2.js
CREATE OR REPLACE FUNCTION djb2_hash(string text)
RETURNS bigint
IMMUTABLE
STRICT
LANGUAGE sql
AS $$
WITH RECURSIVE t(seed, string) AS (
VALUES (
87049::bigint,
$1