protected void generateMailHash(StringBuilder sb, String email) throws NoSuchAlgorithmException {
        MessageDigest md = MessageDigest.getInstance("MD5"); // NOSONAR
        md.update(email.getBytes(StandardCharsets.UTF_8));
        byte[] digest = md.digest();
        for (byte b : digest) {
            sb.append(String.format("%02x", b & 0xff));
        }
    }
Converts email address into a hash code for Gravatar API.

@param sb the Stringbuilder to add the email address to
@param email the email to encode
@throws NoSuchAlgorithmException if hash can't be encoded
primefaces/src/main/java/org/primefaces/component/avatar/AvatarRenderer.java