翰林优商.apk(点击下载) / c.java


package com.umeng.umverify.utils;

import android.text.TextUtils;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Random;
import kotlin.UByte;

public final class c {
    public static String a() {
        int i;
        StringBuilder sb = new StringBuilder();
        Random random = new Random();
        Random random2 = new Random();
        for (int i2 = 0; i2 < 12; i2++) {
            int nextInt = random.nextInt(3);
            if (nextInt != 0) {
                if (nextInt == 1) {
                    i = random2.nextInt(26) + 65;
                } else if (nextInt == 2) {
                    i = random2.nextInt(26) + 97;
                }
                sb.append((char) i);
            } else {
                sb.append(random2.nextInt(10));
            }
        }
        String sb2 = sb.toString();
        return TextUtils.isEmpty(sb2) ? "O8E6T7xqycg2" : sb2;
    }

    public static String a(String str) {
        if (TextUtils.isEmpty(str)) {
            return "";
        }
        try {
            String str2 = "";
            for (byte b : MessageDigest.getInstance("MD5").digest(str.getBytes())) {
                String hexString = Integer.toHexString(b & UByte.MAX_VALUE);
                if (hexString.length() == 1) {
                    hexString = "0".concat(String.valueOf(hexString));
                }
                str2 = str2 + hexString;
            }
            return str2;
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            return "";
        }
    }
}