public final class DigestUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
base64(byte[] bytes)
Converts the given byte array to a base64 string.
|
static byte[] |
best(byte[] bytes)
Gets the given byte array's best available hash.
|
static byte[] |
best(String s)
Gets the given string's best available hash.
|
static String |
bestBase64(byte[] bytes)
Gets the base64 string of the given byte array's best available hash.
|
static String |
bestBase64(String text)
Gets the base64 string of the given string's best available hash.
|
static String |
bestHex(byte[] bytes)
Gets the hex string of the given byte array's best available hash.
|
static String |
bestHex(String text)
Gets the hex string of the given string's best available hash.
|
static byte[] |
bytes(int i)
Converts the given integer into a byte array.
|
static byte[] |
bytes(String s)
Converts the given string to a byte array.
|
static byte[] |
digest(String algorithm,
byte[] bytes)
Gets the given byte array's hash value according to the specified
algorithm.
|
static byte[] |
hash(byte[] bytes)
Gets the hash code of the given byte array, as a byte array.
|
static byte[] |
hash(String s)
Gets the Java hash code of the given string, as a byte array.
|
static String |
hex(byte[] bytes)
Converts the given byte array to a hexidecimal string.
|
static byte[] |
md5(byte[] bytes)
Gets the given byte array's MD5 checksum, or null if unavailable.
|
static byte[] |
sha1(byte[] bytes)
Gets the given byte array's SHA-1 checksum, or null if unavailable.
|
static String |
string(byte[] bytes)
Converts the given byte array to a string.
|
public static String string(byte[] bytes)
public static byte[] bytes(String s)
public static byte[] bytes(int i)
public static String hex(byte[] bytes)
public static String base64(byte[] bytes)
public static byte[] hash(String s)
String.hashCode()public static byte[] hash(byte[] bytes)
String.hashCode(),
string(byte[])public static byte[] sha1(byte[] bytes)
public static byte[] md5(byte[] bytes)
public static byte[] digest(String algorithm, byte[] bytes)
algorithm - The algorithm to use when generating the hash value.bytes - The byte array for which to compute the hash value.MessageDigestpublic static byte[] best(String s)
bytes(String),
sha1(byte[]),
md5(byte[]),
hash(String)public static byte[] best(byte[] bytes)
sha1(byte[]),
md5(byte[]),
hash(byte[])public static String bestHex(String text)
best(String),
hex(byte[])public static String bestHex(byte[] bytes)
best(byte[]),
hex(byte[])public static String bestBase64(String text)
best(String),
base64(byte[])public static String bestBase64(byte[] bytes)
best(byte[]),
base64(byte[])Copyright © 2015–2022 SciJava. All rights reserved.