Skip to content

Commit

Permalink
Use constants to replace strings
Browse files Browse the repository at this point in the history
  • Loading branch information
luoyesiqiu committed Oct 22, 2023
1 parent c372fb7 commit ae440c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dpt/src/main/java/com/luoye/dpt/util/Md5Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
* @author luoyesiqiu
*/
public class Md5Utils extends MessageDigestUtils {
private static final String ALGORITHM = "md5";

public static String md5(byte[] input){
return hash("md5",input);
return hash(ALGORITHM,input);
}

public static String shortMd5(byte[] input){
Expand Down
4 changes: 3 additions & 1 deletion dpt/src/main/java/com/luoye/dpt/util/ShaUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
* @author luoyesiqiu
*/
public class ShaUtils extends MessageDigestUtils{
private static final String ALGORITHM = "sha-256";

public static String sha256(byte[] input){
return hash("sha-256",input);
return hash(ALGORITHM,input);
}

public static String shortSha256Left(byte[] input) {
Expand Down

0 comments on commit ae440c3

Please sign in to comment.