package a.b.a.i;

import a.a.a.b;
import android.text.TextUtils;
import com.google.common.primitives.UnsignedBytes;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class i {

    /* renamed from: a  reason: collision with root package name */
    private static final String f37a = "ShaUtil";

    public static String a(String str) {
        if (TextUtils.isEmpty(str)) {
            return "";
        }
        try {
            String str2 = "";
            for (byte b : MessageDigest.getInstance("sha-256").digest(str.getBytes())) {
                String hexString = Integer.toHexString(b & UnsignedBytes.MAX_VALUE);
                if (hexString.length() == 1) {
                    hexString = "0" + hexString;
                }
                str2 = str2 + hexString;
            }
            return str2;
        } catch (NoSuchAlgorithmException e) {
            b.b(f37a, "ShaUtil error", e);
            return "";
        }
    }
}
