public class MdHelp extends Object
| Modifier and Type | Field and Description |
|---|---|
String |
algorithm |
int |
hexLength |
static int |
LEN_MD5_HEX |
static int |
LEN_SHA1_HEX |
static int |
LEN_SHA256_HEX |
static String |
MD_MD5 |
static String |
MD_SHA1 |
static String |
MD_SHA256 |
static MdHelp |
md5 |
static MdHelp |
sha1 |
static MdHelp |
sha256 |
| Modifier | Constructor and Description |
|---|---|
protected |
MdHelp(String algorithm) |
protected |
MdHelp(String algorithm,
int hexLen) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
asSum(@Nullable String str) |
boolean |
check(@Nullable String sum,
byte[] bytes) |
boolean |
check(@Nullable String sum,
@Nullable InputStream ins) |
boolean |
check(@Nullable String sum,
@Nullable String str) |
static boolean |
checks(@Nullable String sum,
@Nullable Object obj)
Auto check sum based on sum length, and obj type
|
byte[] |
digest(byte[] bytes) |
@NotNull String |
getAlgorithm() |
int |
getHexLength() |
static int |
guessHexLength(@NotNull String algorithm)
guess hex sum length, return 0 if not (MD5,SHA-1,SHA-256)
|
boolean |
isSum(@Nullable String str) |
static @NotNull MessageDigest |
newMd5() |
@NotNull MessageDigest |
newOne()
create a Mac instance, the instance it not thread-safe
|
static @NotNull MessageDigest |
newOne(@NotNull String algorithm) |
static @NotNull MessageDigest |
newSha1() |
static @NotNull MessageDigest |
newSha256() |
static @NotNull MdHelp |
of(@NotNull String algorithm) |
static @NotNull MdHelp |
of(@NotNull String algorithm,
int hexLen) |
@NotNull String |
sum(byte[] bytes) |
@NotNull String |
sum(byte[] bytes,
boolean upper) |
@NotNull String |
sum(@Nullable InputStream ins) |
@NotNull String |
sum(@Nullable InputStream ins,
boolean upper) |
@NotNull String |
sum(@Nullable String str) |
@NotNull String |
sum(@Nullable String str,
boolean upper) |
public final String algorithm
public final int hexLength
public static final int LEN_MD5_HEX
public static final int LEN_SHA1_HEX
public static final int LEN_SHA256_HEX
public static final String MD_MD5
public static final String MD_SHA1
public static final String MD_SHA256
public static final MdHelp md5
public static final MdHelp sha1
public static final MdHelp sha256
protected MdHelp(String algorithm)
protected MdHelp(String algorithm, int hexLen)
public boolean isSum(@Nullable
@Nullable String str)
public boolean asSum(@Nullable
@Nullable String str)
@NotNull public @NotNull String getAlgorithm()
public int getHexLength()
@NotNull public @NotNull String sum(@Nullable @Nullable InputStream ins)
@NotNull public @NotNull String sum(byte[] bytes)
@NotNull public @NotNull String sum(@Nullable @Nullable InputStream ins, boolean upper)
@NotNull public @NotNull String sum(byte[] bytes, boolean upper)
public byte[] digest(byte[] bytes)
@NotNull public @NotNull MessageDigest newOne()
public boolean check(@Nullable
@Nullable String sum,
byte[] bytes)
public boolean check(@Nullable
@Nullable String sum,
@Nullable
@Nullable InputStream ins)
public static int guessHexLength(@NotNull
@NotNull String algorithm)
@NotNull public static @NotNull MessageDigest newMd5()
@NotNull public static @NotNull MessageDigest newSha1()
@NotNull public static @NotNull MessageDigest newSha256()
@NotNull public static @NotNull MessageDigest newOne(@NotNull @NotNull String algorithm)
Copyright © 2024. All rights reserved.