converting an hex string into a bigint select ('x'||lpad(substr(md5('haha'),1,8),16,'0'))::bit(64)::bigint Keyword: hex conversion integer int hash