I have the following Java routine that I need to translate to Delphi. I know how to do the Base64 encoding but I am not sure what the Delphi equivalent for MessageDigest is. How would I write this method in Delphi?
private String getHashCode(String s) {
String outputHash;
try {
MessageDigest digest = MessageDigest.getInstance("SHA-1"); // SHA-256
byte[] hash = digest.digest(s.getBytes(StandardCharsets.UTF_8));
outputHash = Base64.getEncoder().encodeToString(hash);
} catch (Exception ex) {
outputHash = "";
}
return outputHash;
}