类 DigestUtils
java.lang.Object
cn.taketoday.util.DigestUtils
Miscellaneous methods for calculating digests.
Mainly for internal use within the framework; consider Apache Commons Codec for a more comprehensive suite of digest utilities.
- 从以下版本开始:
- 4.0
- 作者:
- Arjen Poutsma, Juergen Hoeller, Craig Andrews, TODAY 2021/8/21 01:27
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明private static StringBuilderappendDigestAsHex(byte[] bytes, StringBuilder builder) private static StringBuilderappendDigestAsHex(InputStream inputStream, StringBuilder builder) static StringBuilderappendMd5DigestAsHex(byte[] bytes, StringBuilder builder) Append a hexadecimal string representation of the MD5 digest of the given bytes to the givenStringBuilder.static StringBuilderappendMd5DigestAsHex(InputStream inputStream, StringBuilder builder) Append a hexadecimal string representation of the MD5 digest of the given inputStream to the givenStringBuilder.private static byte[]private static byte[]digest(String algorithm, InputStream inputStream) private static char[]digestAsHexChars(String algorithm, byte[] bytes) private static char[]digestAsHexChars(String algorithm, InputStream inputStream) private static StringdigestAsHexString(byte[] bytes) private static StringdigestAsHexString(InputStream inputStream) private static char[]encodeHex(byte[] bytes) private static MessageDigestCreate a newMessageDigestwith the given algorithm.static byte[]md5Digest(byte[] bytes) Calculate the MD5 digest of the given bytes.static byte[]md5Digest(InputStream inputStream) Calculate the MD5 digest of the given stream.static Stringmd5DigestAsHex(byte[] bytes) Return a hexadecimal string representation of the MD5 digest of the given bytes.static Stringmd5DigestAsHex(InputStream inputStream) Return a hexadecimal string representation of the MD5 digest of the given stream.
-
字段详细资料
-
MD5_ALGORITHM_NAME
- 另请参阅:
-
HEX_CHARS
private static final char[] HEX_CHARS
-
-
构造器详细资料
-
DigestUtils
public DigestUtils()
-
-
方法详细资料
-
md5Digest
public static byte[] md5Digest(byte[] bytes) Calculate the MD5 digest of the given bytes.- 参数:
bytes- the bytes to calculate the digest over- 返回:
- the digest
-
md5Digest
Calculate the MD5 digest of the given stream.This method does not close the input stream.
- 参数:
inputStream- the InputStream to calculate the digest over- 返回:
- the digest
- 抛出:
IOException
-
md5DigestAsHex
Return a hexadecimal string representation of the MD5 digest of the given bytes.- 参数:
bytes- the bytes to calculate the digest over- 返回:
- a hexadecimal digest string
-
md5DigestAsHex
Return a hexadecimal string representation of the MD5 digest of the given stream.This method does not close the input stream.
- 参数:
inputStream- the InputStream to calculate the digest over- 返回:
- a hexadecimal digest string
- 抛出:
IOException
-
appendMd5DigestAsHex
Append a hexadecimal string representation of the MD5 digest of the given bytes to the givenStringBuilder.- 参数:
bytes- the bytes to calculate the digest overbuilder- the string builder to append the digest to- 返回:
- the given string builder
-
appendMd5DigestAsHex
public static StringBuilder appendMd5DigestAsHex(InputStream inputStream, StringBuilder builder) throws IOException Append a hexadecimal string representation of the MD5 digest of the given inputStream to the givenStringBuilder.This method does not close the input stream.
- 参数:
inputStream- the inputStream to calculate the digest overbuilder- the string builder to append the digest to- 返回:
- the given string builder
- 抛出:
IOException
-
getDigest
Create a newMessageDigestwith the given algorithm.Necessary because
MessageDigestis not thread-safe. -
digest
-
digest
- 抛出:
IOException
-
digestAsHexString
-
digestAsHexString
- 抛出:
IOException
-
appendDigestAsHex
-
appendDigestAsHex
private static StringBuilder appendDigestAsHex(InputStream inputStream, StringBuilder builder) throws IOException - 抛出:
IOException
-
digestAsHexChars
-
digestAsHexChars
private static char[] digestAsHexChars(String algorithm, InputStream inputStream) throws IOException - 抛出:
IOException
-
encodeHex
private static char[] encodeHex(byte[] bytes)
-