Java Utililty Methods Digest

List of utility methods to do Digest

Description

The list of methods to do Digest are organized into topic(s).

Method

Stringdigest(String ha1, String ha2, String nonce)
digest
try {
    MessageDigest md = MessageDigest.getInstance("MD5");
    md.update(getBytes(ha1, ISO_8859_1));
    md.update((byte) ':');
    md.update(getBytes(nonce, ISO_8859_1));
    md.update((byte) ':');
    md.update(getBytes(ha2, ISO_8859_1));
    return toHexString(md.digest());
...
byte[]digest(String input, Charset charset)
digest
return digest(input.getBytes(charset));
byte[]digest(String input, String algorithm, String encoding)
digest
MessageDigest messageDigest = MessageDigest.getInstance(algorithm);
return messageDigest.digest(input.getBytes(encoding));
Stringdigest(String key)
digest
byte[] bs = md5digest(key);
return byte2hex(bs);
byte[]digest(String message, byte[] salt)
Create a digest from salt and a message.
try {
    byte[] msg = message.getBytes("UTF-8");
    md.update(salt);
    md.update(msg);
} catch (Exception ex) {
return md.digest();
Stringdigest(String name, String source)
digest
if (source != null) {
    final MessageDigest md = MessageDigest.getInstance(name);
    md.update(source.getBytes());
    return toHexString(md.digest());
return null;
Stringdigest(String orgin, String algorithm)
digest
try {
    byte[] strTemp = orgin.getBytes("utf-8");
    MessageDigest mdTemp = MessageDigest.getInstance(algorithm);
    mdTemp.update(strTemp);
    byte[] md = mdTemp.digest();
    return bytes2hex(md);
} catch (Exception e) {
    return null;
...
Stringdigest(String password)
digest
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(password.getBytes());
byte byteData[] = md.digest();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < byteData.length; i++) {
    sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1));
return sb.toString();
...
Stringdigest(String plain, String algorithm)
digest
MessageDigest messageDigest;
messageDigest = MessageDigest.getInstance(algorithm);
byte[] bytes = toByteArray(plain);
byte[] digestedBytes = messageDigest.digest(bytes);
String hex = toHexString(digestedBytes);
return hex;
Stringdigest(String planeText)
digest
MessageDigest digest = createMessageDigest();
byte[] b = planeText.getBytes();
String hex = toHexString(digest.digest(b));
return hex;