public class DigestHelper extends Object
Modifier and Type | Field | Description |
---|---|---|
static int |
ENCODE_BASE64 |
|
static int |
ENCODE_HEX |
|
static String |
MD5 |
|
static String |
SHA1 |
Constructor | Description |
---|---|
DigestHelper() |
Modifier and Type | Method | Description |
---|---|---|
static long |
crc32(File testFile) |
|
static long |
crc32(InputStream is) |
|
static String |
digest(File testFile,
String algorithm,
int encoding) |
|
static byte[] |
digest(InputStream is,
String algorithm) |
|
static String |
digest(InputStream is,
String algorithm,
int encoding) |
|
static String |
md5(File testFile) |
|
static String |
md5(File testFile,
int encoding) |
|
static byte[] |
sha1(byte[] plaintext) |
|
static String |
sha1(File testFile) |
|
static String |
sha1(File testFile,
int encoding) |
|
static String |
sha1(InputStream is,
int encoding) |
|
static String |
sha1(String plaintext) |
|
static String |
sha1(String plaintext,
int encoding) |
|
static byte[] |
sha1hmac(byte[] key,
byte[] text) |
|
static String |
sha1hmac(String key,
String plaintext) |
Performs HMAC-SHA1 on the UTF-8 byte representation of strings
|
static String |
sha1hmac(String key,
String plaintext,
int encoding) |
Performs HMAC-SHA1 on the UTF-8 byte representation of strings, returning the hexidecimal hash as a result
|
public static final int ENCODE_BASE64
public static final int ENCODE_HEX
public static final String SHA1
public static final String MD5
public static String sha1hmac(String key, String plaintext)
key
- plaintext
- public static String sha1hmac(String key, String plaintext, int encoding)
key
- plaintext
- public static byte[] sha1hmac(byte[] key, byte[] text) throws IllegalArgumentException
key
- text
- IllegalArgumentException
public static byte[] sha1(byte[] plaintext) throws NoSuchAlgorithmException
NoSuchAlgorithmException
public static String sha1(String plaintext) throws IOException, NoSuchAlgorithmException
IOException
NoSuchAlgorithmException
public static String sha1(String plaintext, int encoding) throws IOException, NoSuchAlgorithmException
IOException
NoSuchAlgorithmException
public static String sha1(File testFile) throws FileNotFoundException, IOException, NoSuchAlgorithmException
public static String sha1(File testFile, int encoding) throws FileNotFoundException, IOException, NoSuchAlgorithmException
public static String sha1(InputStream is, int encoding) throws FileNotFoundException, IOException, NoSuchAlgorithmException
public static String digest(File testFile, String algorithm, int encoding) throws IOException, NoSuchAlgorithmException
IOException
NoSuchAlgorithmException
public static byte[] digest(InputStream is, String algorithm) throws IOException, NoSuchAlgorithmException
IOException
NoSuchAlgorithmException
public static String digest(InputStream is, String algorithm, int encoding) throws IOException, NoSuchAlgorithmException
IOException
NoSuchAlgorithmException
public static long crc32(File testFile) throws FileNotFoundException, IOException
FileNotFoundException
IOException
public static long crc32(InputStream is) throws IOException
IOException
public static String md5(File testFile) throws FileNotFoundException, IOException, NoSuchAlgorithmException
public static String md5(File testFile, int encoding) throws FileNotFoundException, IOException, NoSuchAlgorithmException
Copyright © 2018. All rights reserved.