package fa;

import com.google.crypto.tink.proto.HashType;
import com.google.crypto.tink.proto.OutputPrefixType;
import java.security.GeneralSecurityException;
import ma.p0;
import ma.v;
import ma.x;
import ra.t0;
import ra.u0;

/* JADX INFO: loaded from: classes2.dex */
public abstract class a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final x f25980a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final v f25981b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final ma.f f25982c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final ma.d f25983d;

    static {
        ta.a aVarC = p0.c("type.googleapis.com/google.crypto.tink.AesCtrHmacAeadKey");
        f25980a = new x(new androidx.core.view.n(12), ea.m.class);
        f25981b = new v(new androidx.core.view.n(13), aVarC);
        f25982c = new ma.f(new androidx.core.view.n(14), ea.g.class);
        f25983d = new ma.d(new androidx.core.view.n(15), aVarC);
    }

    public static u0 a(ea.m mVar) {
        HashType hashType;
        t0 t0VarI = u0.I();
        int i10 = mVar.f25700d;
        t0VarI.f();
        u0.E((u0) t0VarI.f23982b, i10);
        ea.k kVar = ea.k.f25677b;
        ea.k kVar2 = mVar.f25702f;
        if (kVar.equals(kVar2)) {
            hashType = HashType.SHA1;
        } else if (ea.k.f25678c.equals(kVar2)) {
            hashType = HashType.SHA224;
        } else if (ea.k.f25679d.equals(kVar2)) {
            hashType = HashType.SHA256;
        } else if (ea.k.f25680e.equals(kVar2)) {
            hashType = HashType.SHA384;
        } else {
            if (!ea.k.f25681f.equals(kVar2)) {
                throw new GeneralSecurityException("Unable to serialize HashType " + kVar2);
            }
            hashType = HashType.SHA512;
        }
        t0VarI.f();
        u0.D((u0) t0VarI.f23982b, hashType);
        return (u0) t0VarI.c();
    }

    public static ea.k b(HashType hashType) throws GeneralSecurityException {
        int iOrdinal = hashType.ordinal();
        if (iOrdinal == 1) {
            return ea.k.f25677b;
        }
        if (iOrdinal == 2) {
            return ea.k.f25680e;
        }
        if (iOrdinal == 3) {
            return ea.k.f25679d;
        }
        if (iOrdinal == 4) {
            return ea.k.f25681f;
        }
        if (iOrdinal == 5) {
            return ea.k.f25678c;
        }
        throw new GeneralSecurityException("Unable to parse HashType: " + hashType.b());
    }

    public static OutputPrefixType c(ea.l lVar) throws GeneralSecurityException {
        if (ea.l.f25686b.equals(lVar)) {
            return OutputPrefixType.TINK;
        }
        if (ea.l.f25687c.equals(lVar)) {
            return OutputPrefixType.CRUNCHY;
        }
        if (ea.l.f25688d.equals(lVar)) {
            return OutputPrefixType.RAW;
        }
        throw new GeneralSecurityException("Unable to serialize variant: " + lVar);
    }

    public static ea.l d(OutputPrefixType outputPrefixType) throws GeneralSecurityException {
        int iOrdinal = outputPrefixType.ordinal();
        if (iOrdinal == 1) {
            return ea.l.f25686b;
        }
        if (iOrdinal != 2) {
            if (iOrdinal == 3) {
                return ea.l.f25688d;
            }
            if (iOrdinal != 4) {
                throw new GeneralSecurityException("Unable to parse OutputPrefixType: " + outputPrefixType.b());
            }
        }
        return ea.l.f25687c;
    }
}
