package com.backendsys.utils;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5Util {
    public static String encrypt(String input) throws NoSuchAlgorithmException {
        MessageDigest md = MessageDigest.getInstance("MD5");
        byte[] messageDigest = md.digest(input.getBytes());
        StringBuilder hexString = new StringBuilder();
        for (byte digest : messageDigest) {
            String hex = String.format("%02x", digest);
            hexString.append(hex);
        }
        return hexString.toString();
    }
}
