package com.icomsys.main_vm.common.util;

import javax.xml.bind.DatatypeConverter;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class HashUtil {

    public static String getStringToChecksum(String contents) throws NoSuchAlgorithmException {
        // String 값을 입력받아 md5 hash + base64 encoding
        MessageDigest md = MessageDigest.getInstance("MD5");
        md.update(contents.getBytes());
        return DatatypeConverter.printBase64Binary(md.digest());
    }
}
