Class HashUtils
java.lang.Object
cool.scx.common.util.HashUtils
HashUtils (注意 !!! 返回的十六进制均为大写格式)
- Version:
- 0.0.1
- Author:
- scx567888
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longcrc32(byte[] data) static longstatic longcrc32(InputStream data) static longstatic longcrc32(Path data, OpenOption... options) static longcrc32c(byte[] data) static longstatic longcrc32c(InputStream data) static longstatic longcrc32c(Path data, OpenOption... options) static Stringcrc32cHex(byte[] data) static Stringstatic Stringcrc32cHex(InputStream data) static Stringstatic Stringcrc32cHex(Path data, OpenOption... options) static Stringcrc32Hex(byte[] data) static Stringstatic Stringcrc32Hex(InputStream data) static Stringstatic Stringcrc32Hex(Path data, OpenOption... options) static byte[]static longstatic byte[]static longstatic byte[]hash(InputStream data, String algorithm) static longhash(InputStream data, Supplier<Checksum> checksumSupplier) static byte[]static longstatic byte[]hash(Path data, String algorithm, OpenOption... options) static longhash(Path data, Supplier<Checksum> checksumSupplier, OpenOption... options) static Stringstatic Stringstatic Stringstatic Stringstatic StringhashAsHex(InputStream data, String algorithm) static StringhashAsHex(InputStream data, Supplier<Checksum> checksumSupplier) static Stringstatic Stringstatic StringhashAsHex(Path data, String algorithm, OpenOption... options) static StringhashAsHex(Path data, Supplier<Checksum> checksumSupplier, OpenOption... options) static byte[]md5(byte[] data) static byte[]static byte[]md5(InputStream data) static byte[]static byte[]md5(Path data, OpenOption... options) static Stringmd5Hex(byte[] data) static Stringstatic Stringmd5Hex(InputStream data) static Stringstatic Stringmd5Hex(Path data, OpenOption... options) static byte[]sha1(byte[] data) static byte[]static byte[]sha1(InputStream data) static byte[]static byte[]sha1(Path data, OpenOption... options) static Stringsha1Hex(byte[] data) static Stringstatic Stringsha1Hex(InputStream data) static Stringstatic Stringsha1Hex(Path data, OpenOption... options) static byte[]sha256(byte[] data) static byte[]static byte[]sha256(InputStream data) static byte[]static byte[]sha256(Path data, OpenOption... options) static Stringsha256Hex(byte[] data) static Stringstatic Stringsha256Hex(InputStream data) static Stringstatic Stringsha256Hex(Path data, OpenOption... options) static byte[]sha384(byte[] data) static byte[]static byte[]sha384(InputStream data) static byte[]static byte[]sha384(Path data, OpenOption... options) static Stringsha384Hex(byte[] data) static Stringstatic Stringsha384Hex(InputStream data) static Stringstatic Stringsha384Hex(Path data, OpenOption... options) static byte[]sha512(byte[] data) static byte[]static byte[]sha512(InputStream data) static byte[]static byte[]sha512(Path data, OpenOption... options) static Stringsha512Hex(byte[] data) static Stringstatic Stringsha512Hex(InputStream data) static Stringstatic Stringsha512Hex(Path data, OpenOption... options)
-
Constructor Details
-
HashUtils
public HashUtils()
-
-
Method Details
-
hash
- Throws:
NoSuchAlgorithmException
-
hash
- Throws:
NoSuchAlgorithmException
-
hash
public static byte[] hash(InputStream data, String algorithm) throws IOException, NoSuchAlgorithmException - Throws:
IOExceptionNoSuchAlgorithmException
-
hash
- Throws:
IOExceptionNoSuchAlgorithmException
-
hash
public static byte[] hash(Path data, String algorithm, OpenOption... options) throws IOException, NoSuchAlgorithmException - Throws:
IOExceptionNoSuchAlgorithmException
-
hash
-
hash
-
hash
- Throws:
IOException
-
hash
- Throws:
IOException
-
hash
public static long hash(Path data, Supplier<Checksum> checksumSupplier, OpenOption... options) throws IOException - Throws:
IOException
-
hashAsHex
- Throws:
NoSuchAlgorithmException
-
hashAsHex
- Throws:
NoSuchAlgorithmException
-
hashAsHex
public static String hashAsHex(InputStream data, String algorithm) throws IOException, NoSuchAlgorithmException - Throws:
IOExceptionNoSuchAlgorithmException
-
hashAsHex
public static String hashAsHex(File data, String algorithm) throws IOException, NoSuchAlgorithmException - Throws:
IOExceptionNoSuchAlgorithmException
-
hashAsHex
public static String hashAsHex(Path data, String algorithm, OpenOption... options) throws IOException, NoSuchAlgorithmException - Throws:
IOExceptionNoSuchAlgorithmException
-
hashAsHex
-
hashAsHex
-
hashAsHex
public static String hashAsHex(InputStream data, Supplier<Checksum> checksumSupplier) throws IOException - Throws:
IOException
-
hashAsHex
- Throws:
IOException
-
hashAsHex
public static String hashAsHex(Path data, Supplier<Checksum> checksumSupplier, OpenOption... options) throws IOException - Throws:
IOException
-
sha1
public static byte[] sha1(byte[] data) -
sha1
-
sha1
- Throws:
IOException
-
sha1
- Throws:
IOException
-
sha1
- Throws:
IOException
-
sha1Hex
-
sha1Hex
-
sha1Hex
- Throws:
IOException
-
sha1Hex
- Throws:
IOException
-
sha1Hex
- Throws:
IOException
-
sha256
public static byte[] sha256(byte[] data) -
sha256
-
sha256
- Throws:
IOException
-
sha256
- Throws:
IOException
-
sha256
- Throws:
IOException
-
sha256Hex
-
sha256Hex
-
sha256Hex
- Throws:
IOException
-
sha256Hex
- Throws:
IOException
-
sha256Hex
- Throws:
IOException
-
sha384
public static byte[] sha384(byte[] data) -
sha384
-
sha384
- Throws:
IOException
-
sha384
- Throws:
IOException
-
sha384
- Throws:
IOException
-
sha384Hex
-
sha384Hex
-
sha384Hex
- Throws:
IOException
-
sha384Hex
- Throws:
IOException
-
sha384Hex
- Throws:
IOException
-
sha512
public static byte[] sha512(byte[] data) -
sha512
-
sha512
- Throws:
IOException
-
sha512
- Throws:
IOException
-
sha512
- Throws:
IOException
-
sha512Hex
-
sha512Hex
-
sha512Hex
- Throws:
IOException
-
sha512Hex
- Throws:
IOException
-
sha512Hex
- Throws:
IOException
-
md5
public static byte[] md5(byte[] data) -
md5
-
md5
- Throws:
IOException
-
md5
- Throws:
IOException
-
md5
- Throws:
IOException
-
md5Hex
-
md5Hex
-
md5Hex
- Throws:
IOException
-
md5Hex
- Throws:
IOException
-
md5Hex
- Throws:
IOException
-
crc32
public static long crc32(byte[] data) -
crc32
-
crc32
- Throws:
IOException
-
crc32
- Throws:
IOException
-
crc32
- Throws:
IOException
-
crc32Hex
-
crc32Hex
-
crc32Hex
- Throws:
IOException
-
crc32Hex
- Throws:
IOException
-
crc32Hex
- Throws:
IOException
-
crc32c
public static long crc32c(byte[] data) -
crc32c
-
crc32c
- Throws:
IOException
-
crc32c
- Throws:
IOException
-
crc32c
- Throws:
IOException
-
crc32cHex
-
crc32cHex
-
crc32cHex
- Throws:
IOException
-
crc32cHex
- Throws:
IOException
-
crc32cHex
- Throws:
IOException
-