package vn.sis.appointment; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.HexFormat; final class Hashes { private Hashes() { } static String sha256(String value) { try { byte[] digest = MessageDigest.getInstance("SHA-256") .digest(value.getBytes(StandardCharsets.UTF_8)); return HexFormat.of().formatHex(digest); } catch (NoSuchAlgorithmException ex) { throw new IllegalStateException("JDK khong ho tro SHA-256.", ex); } } }