Top Description Fields Constructors Methods
org.postgresql.util

public Class MD5Digest

extends Object
Class Inheritance
Imports
java.security.MessageDigest, .NoSuchAlgorithmException

MD5-based utility function to obfuscate passwords before network transmission.
Author
Jeremy Wohl

Field Summary

Modifier and TypeField and Description
private static final byte[]

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static void
bytesToHex(byte[] bytes, byte[] hex, int offset)

public static byte[]

Returns:

A 35-byte array, comprising the string "md5" and an MD5 digest.
encode
(byte[]
The connecting user.
user
,
byte[]
The connecting user's password.
password
,
byte[]
A four-salt sent by the server.
salt
)

Encodes user/password/salt information in the following way: MD5(MD5(password + user) + salt).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

HEX_BYTESback to summary
private static final byte[] HEX_BYTES

Constructor Detail

MD5Digestback to summary
private MD5Digest()

Method Detail

bytesToHexback to summary
public static void bytesToHex(byte[] bytes, byte[] hex, int offset)
encodeback to summary
public static byte[] encode(byte[] user, byte[] password, byte[] salt)

Encodes user/password/salt information in the following way: MD5(MD5(password + user) + salt).

Parameters
user:byte[]

The connecting user.

password:byte[]

The connecting user's password.

salt:byte[]

A four-salt sent by the server.

Returns:byte[]

A 35-byte array, comprising the string "md5" and an MD5 digest.