]> granicus.if.org Git - postgresql/commit
I would like to do a interface change in pgcrypto. (Good
authorBruce Momjian <bruce@momjian.us>
Wed, 24 Jan 2001 03:46:16 +0000 (03:46 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 24 Jan 2001 03:46:16 +0000 (03:46 +0000)
commitcb5427ee4770bb224a3f884a83614ceee85f36ab
tree105903f1043e5e35f2216649d5a70523484561bb
parentbd0a767eab5f4d4963bf12c05cb9b5a135172b14
I would like to do a interface change in pgcrypto.  (Good
timing, I know :))  At the moment the digest() function returns
hexadecimal coded hash, but I want it to return pure binary.  I
have also included functions encode() and decode() which support
'base64' and 'hex' encodings, so if anyone needs digest() in hex
he can do encode(digest(...), 'hex').

Main reason for it is "to do one thing and do it well" :)

Another reason is if someone needs really lot of digesting, in
the end he wants to store the binary not the hexadecimal result.
It is really silly to convert it to hex then back to binary
again.  As I said if someone needs hex he can get it.

Well, and the real reason that I am doing encrypt()/decrypt()
functions and _they_ return binary.  For testing I like to see
it in hex occasionally, but it is really wrong to let them
return hex.  Only now it caught my eye that hex-coding in
digest() is wrong.  When doing digest() I thought about 'common
case' but hacking with psql is probably _not_ the common case :)

Marko Kreen
contrib/pgcrypto/Makefile
contrib/pgcrypto/README.pgcrypto
contrib/pgcrypto/encode.c [new file with mode: 0644]
contrib/pgcrypto/encode.h [new file with mode: 0644]
contrib/pgcrypto/pgcrypto.c
contrib/pgcrypto/pgcrypto.sql.in