public class CryptographyUtils
extends java.lang.Object
构造器和说明 |
---|
CryptographyUtils() |
限定符和类型 | 方法和说明 |
---|---|
static java.lang.String |
byteArrayToHex(byte[] bytes)
Revert byte to hex
|
static boolean |
checkMD5(java.lang.String md5,
java.io.File updateFile)
Check if the file's MD5 is equals to the string of MD5 which you provide.
|
static java.lang.String |
getCryptography(java.lang.String content,
java.lang.String encryptType) |
static java.lang.String |
getMD5(java.lang.String content)
Get the MD5 of the String
|
static java.lang.String |
getMd5FromFile(java.io.File inputFile) |
static java.lang.String |
getMd5FromFile(java.lang.String filePath)
Get the MD5 of the file
|
static java.lang.String |
getSHA1(java.lang.String content)
Get the SHA1 of the String
|
static byte[] |
hexToByteArray(byte[] hexByte)
Revert hex byte to byte array
|
static byte[] |
hexToByteArray(java.lang.String hexString)
Revert hex String to byte array.
|
public static java.lang.String getMD5(java.lang.String content) throws java.security.NoSuchAlgorithmException
content
- java.security.NoSuchAlgorithmException
public static java.lang.String getSHA1(java.lang.String content) throws java.security.NoSuchAlgorithmException
content
- java.security.NoSuchAlgorithmException
public static java.lang.String getCryptography(java.lang.String content, java.lang.String encryptType) throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
public static java.lang.String getMd5FromFile(java.lang.String filePath) throws java.io.IOException, java.security.NoSuchAlgorithmException
filePath
- java.io.IOException
java.security.NoSuchAlgorithmException
public static java.lang.String getMd5FromFile(java.io.File inputFile) throws java.io.IOException, java.security.NoSuchAlgorithmException
java.io.IOException
java.security.NoSuchAlgorithmException
public static java.lang.String byteArrayToHex(byte[] bytes)
bytes
- public static byte[] hexToByteArray(byte[] hexByte)
hexByte
- public static byte[] hexToByteArray(java.lang.String hexString)
hexString
- public static boolean checkMD5(java.lang.String md5, java.io.File updateFile) throws java.io.IOException, java.security.NoSuchAlgorithmException
md5
- updateFile
- java.io.IOException
java.security.NoSuchAlgorithmException