summaryrefslogtreecommitdiff
path: root/contrib/pgcrypto/crypt-md5.c
diff options
context:
space:
mode:
authorNeil Conway2006-07-13 04:15:25 +0000
committerNeil Conway2006-07-13 04:15:25 +0000
commit1abf76e82cbb5c09f5517d155ea404727f67a507 (patch)
tree8d286cfb4963dc8e13bbb322569e36d8a008e797 /contrib/pgcrypto/crypt-md5.c
parent99ac1e69ba750c40cc83e344a1eb65aaa325a296 (diff)
"Annual" pgcrypto update from Marko Kreen:
Few cleanups and couple of new things: - add SHA2 algorithm to older OpenSSL - add BIGNUM math to have public-key cryptography work on non-OpenSSL build. - gen_random_bytes() function The status of SHA2 algoritms and public-key encryption can now be changed to 'always available.' That makes pgcrypto functionally complete and unless there will be new editions of AES, SHA2 or OpenPGP standards, there is no major changes planned.
Diffstat (limited to 'contrib/pgcrypto/crypt-md5.c')
-rw-r--r--contrib/pgcrypto/crypt-md5.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/contrib/pgcrypto/crypt-md5.c b/contrib/pgcrypto/crypt-md5.c
index a9f22c412aa..556a0e9e8e8 100644
--- a/contrib/pgcrypto/crypt-md5.c
+++ b/contrib/pgcrypto/crypt-md5.c
@@ -8,7 +8,7 @@
*
* $FreeBSD: src/lib/libcrypt/crypt-md5.c,v 1.5 1999/12/17 20:21:45 peter Exp $
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-md5.c,v 1.6 2005/10/15 02:49:06 momjian Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-md5.c,v 1.7 2006/07/13 04:15:24 neilc Exp $
*/
#include "postgres.h"
@@ -17,6 +17,20 @@
#include "px-crypt.h"
#define MD5_SIZE 16
+
+static const char _crypt_a64[] =
+"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+
+static void
+_crypt_to64(char *s, unsigned long v, int n)
+{
+ while (--n >= 0)
+ {
+ *s++ = _crypt_a64[v & 0x3f];
+ v >>= 6;
+ }
+}
+
/*
* UNIX password
*/