string, use
    <code class="function">encode()</code> on the result.  For example:
</p><pre class="programlisting">
CREATE OR REPLACE FUNCTION sha1(bytea) returns text AS $$
    SELECT encode(digest($1, 'sha1'), 'hex')
$$ LANGUAGE SQL STRICT IMMUTABLE;
</pre><p>
   </p></div><div class="sect3" id="PGCRYPTO-GENERAL-HASHING-FUNCS-HMAC"><div class="titlepage"><div><div><h4 class="title">F.28.1.2. <code class="function">hmac()</code> <a href="#PGCRYPTO-GENERAL-HASHING-FUNCS-HMAC" class="id_link">#</a></h4></d