urbanairship-core/src/main/java/com/urbanairship/util/UAStringUtil.java
public static String sha256(String value) {
        if (value == null) {
            return null;
        }

        try {
            MessageDigest digest = MessageDigest.getInstance("SHA-256");
            byte[] hash = digest.digest(value.getBytes("UTF-8"));
            return byteToHex(hash);
        } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
            Logger.error("Failed to encode string: " + value, e);
            return null;
        }
    }
/**
     * Returns the sha256 hex string for a given string.
     *
     * @param value The value.
     * @return The sha256 hex string or null if the value is null or it failed encode the string.
     */
Returns the sha256 hex string for a given string.
@param value The value.
@return The sha256 hex string or null if the value is null or it failed encode the string.
Returns the sha256 hex string for a given string . @param value The value . @return The sha256 hex string or null if the value is null or it failed encode the string .
public static String sha256(String value) {
        if (value == null) {
            return null;
        }
        try {
            MessageDigest digest = MessageDigest.getInstance("SHA-256");
            byte[] hash = digest.digest(value.getBytes("UTF-8"));
            return byteToHex(hash);
        } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
            Logger.error("Failed to encode string: " + value, e);
            return null;
        }
    }
public static String sha256 ( String value ) { if ( value == null ) { return null ; } try { MessageDigest digest = MessageDigest . getInstance ( "SHA-256" ) ; byte [ ] hash = digest . digest ( value . getBytes ( "UTF-8" ) ) ; return byteToHex ( hash ) ; } catch ( NoSuchAlgorithmException | UnsupportedEncodingException e ) { Logger . error ( "Failed to encode string: " + value , e ) ; return null ; } }
Returns the sha256 hex string for a given string.
Returns the sha256 hex string for a given string .