diff --git a/contrib/pgcrypto/pgp-armor.c b/contrib/pgcrypto/pgp-armor.c
index 700dc368b71..200c1262ccb 100644
--- a/contrib/pgcrypto/pgp-armor.c
+++ b/contrib/pgcrypto/pgp-armor.c
@@ -43,7 +43,7 @@ static const unsigned char _base64[] =
 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 
 static int
-b64_encode(const uint8 *src, unsigned len, uint8 *dst)
+pg_base64_encode(const uint8 *src, unsigned len, uint8 *dst)
 {
 	uint8	   *p,
 			   *lend = dst + 76;
@@ -93,7 +93,7 @@ b64_encode(const uint8 *src, unsigned len, uint8 *dst)
 
 /* probably should use lookup table */
 static int
-b64_decode(const uint8 *src, unsigned len, uint8 *dst)
+pg_base64_decode(const uint8 *src, unsigned len, uint8 *dst)
 {
 	const uint8 *srcend = src + len,
 			   *s = src;
@@ -161,7 +161,7 @@ b64_decode(const uint8 *src, unsigned len, uint8 *dst)
 }
 
 static unsigned
-b64_enc_len(unsigned srclen)
+pg_base64_enc_len(unsigned srclen)
 {
 	/*
 	 * 3 bytes will be converted to 4, linefeed after 76 chars
@@ -170,7 +170,7 @@ b64_enc_len(unsigned srclen)
 }
 
 static unsigned
-b64_dec_len(unsigned srclen)
+pg_base64_dec_len(unsigned srclen)
 {
 	return (srclen * 3) >> 2;
 }
@@ -215,7 +215,7 @@ pgp_armor_encode(const uint8 *src, unsigned len, uint8 *dst)
 	memcpy(pos, armor_header, n);
 	pos += n;
 
-	n = b64_encode(src, len, pos);
+	n = pg_base64_encode(src, len, pos);
 	pos += n;
 
 	if (*(pos - 1) != '\n')
@@ -356,12 +356,12 @@ pgp_armor_decode(const uint8 *src, unsigned len, uint8 *dst)
 		goto out;
 
 	/* decode crc */
-	if (b64_decode(p + 1, 4, buf) != 3)
+	if (pg_base64_decode(p + 1, 4, buf) != 3)
 		goto out;
 	crc = (((long) buf[0]) << 16) + (((long) buf[1]) << 8) + (long) buf[2];
 
 	/* decode data */
-	res = b64_decode(base64_start, base64_end - base64_start, dst);
+	res = pg_base64_decode(base64_start, base64_end - base64_start, dst);
 
 	/* check crc */
 	if (res >= 0 && crc24(dst, res) != crc)
@@ -373,11 +373,11 @@ out:
 unsigned
 pgp_armor_enc_len(unsigned len)
 {
-	return b64_enc_len(len) + strlen(armor_header) + strlen(armor_footer) + 16;
+	return pg_base64_enc_len(len) + strlen(armor_header) + strlen(armor_footer) + 16;
 }
 
 unsigned
 pgp_armor_dec_len(unsigned len)
 {
-	return b64_dec_len(len);
+	return pg_base64_dec_len(len);
 }
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index 37c8d3f1e76..b295b2df40c 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -215,7 +215,7 @@ static const int8 b64lookup[128] = {
 };
 
 static unsigned
-b64_encode(const char *src, unsigned len, char *dst)
+pg_base64_encode(const char *src, unsigned len, char *dst)
 {
 	char	   *p,
 			   *lend = dst + 76;
@@ -262,7 +262,7 @@ b64_encode(const char *src, unsigned len, char *dst)
 }
 
 static unsigned
-b64_decode(const char *src, unsigned len, char *dst)
+pg_base64_decode(const char *src, unsigned len, char *dst)
 {
 	const char *srcend = src + len,
 			   *s = src;
@@ -331,14 +331,14 @@ b64_decode(const char *src, unsigned len, char *dst)
 
 
 static unsigned
-b64_enc_len(const char *src, unsigned srclen)
+pg_base64_enc_len(const char *src, unsigned srclen)
 {
 	/* 3 bytes will be converted to 4, linefeed after 76 chars */
 	return (srclen + 2) * 4 / 3 + srclen / (76 * 3 / 4);
 }
 
 static unsigned
-b64_dec_len(const char *src, unsigned srclen)
+pg_base64_dec_len(const char *src, unsigned srclen)
 {
 	return (srclen * 3) >> 2;
 }
@@ -531,7 +531,7 @@ static const struct
 	{
 		"base64",
 		{
-			b64_enc_len, b64_dec_len, b64_encode, b64_decode
+			pg_base64_enc_len, pg_base64_dec_len, pg_base64_encode, pg_base64_decode
 		}
 	},
 	{