public static String getSHA(String text, Algorithm algorithm) {
        String sha = "";
        if (TextUtils.isEmpty(text)) {
            return sha;
        }

        MessageDigest shaDigest = getShaDigest(algorithm);

        if (shaDigest != null) {
            byte[] textBytes = text.getBytes();
            shaDigest.update(textBytes, 0, text.length());
            byte[] shahash = shaDigest.digest();
            return bytes2Hex(shahash);
        }

        return null;
    }
Allows to get the SHA of a {@link java.lang.String} using {@link java.security.MessageDigest}
if device does not support sha-256, fall back to sha-1 instead
lib/src/main/java/com/github/omadahealth/lollipin/lib/encryption/Encryptor.java