package p463.p473.p474.p477;

import java.util.Hashtable;
import p138.p139.p143.p144.C2803;
import p463.p473.p474.InterfaceC7145;
import p463.p473.p474.InterfaceC7146;
import p463.p473.p474.InterfaceC7147;
import p463.p473.p474.InterfaceC7148;
import p463.p473.p474.p478.C7157;
import p463.p473.p480.InterfaceC7159;

/* JADX INFO: renamed from: ޒ.ؠ.֏.ކ.֏, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C7155 implements InterfaceC7148 {

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public static Hashtable f20745;

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public InterfaceC7146 f20746;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public int f20747;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public int f20748;

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public InterfaceC7159 f20749;

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public InterfaceC7159 f20750;

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public byte[] f20751;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public byte[] f20752;

    static {
        Hashtable hashtable = new Hashtable();
        f20745 = hashtable;
        hashtable.put("GOST3411", 32);
        f20745.put("MD2", 16);
        f20745.put("MD4", 64);
        f20745.put("MD5", 64);
        f20745.put("RIPEMD128", 64);
        f20745.put("RIPEMD160", 64);
        f20745.put("SHA-1", 64);
        f20745.put("SHA-224", 64);
        f20745.put("SHA-256", 64);
        f20745.put("SHA-384", 128);
        f20745.put("SHA-512", 128);
        f20745.put("Tiger", 64);
        f20745.put("Whirlpool", 64);
    }

    public C7155(InterfaceC7146 interfaceC7146) {
        int iIntValue;
        if (interfaceC7146 instanceof InterfaceC7147) {
            iIntValue = ((InterfaceC7147) interfaceC7146).mo10502();
        } else {
            Integer num = (Integer) f20745.get(interfaceC7146.mo10500());
            if (num == null) {
                StringBuilder sbM4889 = C2803.m4889("unknown digest passed: ");
                sbM4889.append(interfaceC7146.mo10500());
                throw new IllegalArgumentException(sbM4889.toString());
            }
            iIntValue = num.intValue();
        }
        this.f20746 = interfaceC7146;
        int iMo10501 = interfaceC7146.mo10501();
        this.f20747 = iMo10501;
        this.f20748 = iIntValue;
        this.f20751 = new byte[iIntValue];
        this.f20752 = new byte[iIntValue + iMo10501];
    }

    @Override // p463.p473.p474.InterfaceC7148
    /* JADX INFO: renamed from: ֏ */
    public int mo10503() {
        return this.f20747;
    }

    @Override // p463.p473.p474.InterfaceC7148
    /* JADX INFO: renamed from: ֏ */
    public int mo10504(byte[] bArr, int i) {
        this.f20746.mo10496(this.f20752, this.f20748);
        InterfaceC7159 interfaceC7159 = this.f20750;
        if (interfaceC7159 != null) {
            ((InterfaceC7159) this.f20746).mo10517(interfaceC7159);
            InterfaceC7146 interfaceC7146 = this.f20746;
            interfaceC7146.mo10499(this.f20752, this.f20748, interfaceC7146.mo10501());
        } else {
            InterfaceC7146 interfaceC71462 = this.f20746;
            byte[] bArr2 = this.f20752;
            interfaceC71462.mo10499(bArr2, 0, bArr2.length);
        }
        int iMo10496 = this.f20746.mo10496(bArr, i);
        int i2 = this.f20748;
        while (true) {
            byte[] bArr3 = this.f20752;
            if (i2 >= bArr3.length) {
                break;
            }
            bArr3[i2] = 0;
            i2++;
        }
        InterfaceC7159 interfaceC71592 = this.f20749;
        if (interfaceC71592 != null) {
            ((InterfaceC7159) this.f20746).mo10517(interfaceC71592);
        } else {
            InterfaceC7146 interfaceC71463 = this.f20746;
            byte[] bArr4 = this.f20751;
            interfaceC71463.mo10499(bArr4, 0, bArr4.length);
        }
        return iMo10496;
    }

    @Override // p463.p473.p474.InterfaceC7148
    /* JADX INFO: renamed from: ֏ */
    public void mo10505(byte b) {
        this.f20746.mo10498(b);
    }

    @Override // p463.p473.p474.InterfaceC7148
    /* JADX INFO: renamed from: ֏ */
    public void mo10506(InterfaceC7145 interfaceC7145) {
        byte[] bArr;
        this.f20746.mo10497();
        byte[] bArr2 = ((C7157) interfaceC7145).f20754;
        int length = bArr2.length;
        if (length > this.f20748) {
            this.f20746.mo10499(bArr2, 0, length);
            this.f20746.mo10496(this.f20751, 0);
            length = this.f20747;
        } else {
            System.arraycopy(bArr2, 0, this.f20751, 0, length);
        }
        while (true) {
            bArr = this.f20751;
            if (length >= bArr.length) {
                break;
            }
            bArr[length] = 0;
            length++;
        }
        System.arraycopy(bArr, 0, this.f20752, 0, this.f20748);
        byte[] bArr3 = this.f20751;
        int i = this.f20748;
        for (int i2 = 0; i2 < i; i2++) {
            bArr3[i2] = (byte) (bArr3[i2] ^ 54);
        }
        byte[] bArr4 = this.f20752;
        int i3 = this.f20748;
        for (int i4 = 0; i4 < i3; i4++) {
            bArr4[i4] = (byte) (bArr4[i4] ^ 92);
        }
        InterfaceC7146 interfaceC7146 = this.f20746;
        if (interfaceC7146 instanceof InterfaceC7159) {
            InterfaceC7159 interfaceC7159Mo10519 = ((InterfaceC7159) interfaceC7146).mo10519();
            this.f20750 = interfaceC7159Mo10519;
            ((InterfaceC7146) interfaceC7159Mo10519).mo10499(this.f20752, 0, this.f20748);
        }
        InterfaceC7146 interfaceC71462 = this.f20746;
        byte[] bArr5 = this.f20751;
        interfaceC71462.mo10499(bArr5, 0, bArr5.length);
        InterfaceC7146 interfaceC71463 = this.f20746;
        if (interfaceC71463 instanceof InterfaceC7159) {
            this.f20749 = ((InterfaceC7159) interfaceC71463).mo10519();
        }
    }

    @Override // p463.p473.p474.InterfaceC7148
    /* JADX INFO: renamed from: ֏ */
    public void mo10507(byte[] bArr, int i, int i2) {
        this.f20746.mo10499(bArr, i, i2);
    }
}
