public class DigestHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
ENCODE_BASE64 |
static int |
ENCODE_HEX |
static String |
MD5 |
static String |
SHA1 |
| Constructor and Description |
|---|
DigestHelper() |
| Modifier and Type | Method and 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 - IllegalArgumentExceptionpublic static byte[] sha1(byte[] plaintext)
throws NoSuchAlgorithmException
NoSuchAlgorithmExceptionpublic static String sha1(String plaintext) throws IOException, NoSuchAlgorithmException
IOExceptionNoSuchAlgorithmExceptionpublic static String sha1(String plaintext, int encoding) throws IOException, NoSuchAlgorithmException
IOExceptionNoSuchAlgorithmExceptionpublic 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
IOExceptionNoSuchAlgorithmExceptionpublic static byte[] digest(InputStream is, String algorithm) throws IOException, NoSuchAlgorithmException
IOExceptionNoSuchAlgorithmExceptionpublic static String digest(InputStream is, String algorithm, int encoding) throws IOException, NoSuchAlgorithmException
IOExceptionNoSuchAlgorithmExceptionpublic static long crc32(File testFile) throws FileNotFoundException, IOException
FileNotFoundExceptionIOExceptionpublic static long crc32(InputStream is) throws IOException
IOExceptionpublic static String md5(File testFile) throws FileNotFoundException, IOException, NoSuchAlgorithmException
public static String md5(File testFile, int encoding) throws FileNotFoundException, IOException, NoSuchAlgorithmException
Copyright © 2017. All rights reserved.