What I'm trying to do is store an SHA-1 hash in the database, and
create a trigger that runs on insert or update and updates a 'running
hash' record in another table by xoring it with the new (and in the
case of an update, old) hash. The best candidates are bytea, but that
has no xor operation, or bit(n), but there's no way to convert back to
hexadecimal from it.
Also, is there any particular reason sha1() is still not in PGSQL? I
know it's in pgcrypto, but shouldn't it be in main? MD5 is, and that's
now deprecated.