package defpackage;

import java.security.InvalidKeyException;

/* renamed from: ᵮʣˉ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C4174 extends AbstractC0715 {

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final /* synthetic */ int f15596;

    public C4174(byte[] bArr, int i, int i2) throws InvalidKeyException {
        this.f15596 = i2;
        if (bArr.length != 32) {
            throw new InvalidKeyException("The key length in bytes must be 32.");
        }
        this.f3452 = AbstractC2052.m5632(bArr);
        this.f3451 = i;
    }

    @Override // defpackage.AbstractC0715
    /* renamed from: ˏᵙ */
    public final int[] mo2714(int[] iArr, int i) {
        switch (this.f15596) {
            case 0:
                if (iArr.length != 3) {
                    throw new IllegalArgumentException(String.format("ChaCha20 uses 96-bit nonces, but got a %d-bit nonce", Integer.valueOf(iArr.length * 32)));
                }
                int[] iArr2 = new int[16];
                int[] iArr3 = (int[]) this.f3452;
                int[] iArr4 = AbstractC2052.f8202;
                System.arraycopy(iArr4, 0, iArr2, 0, iArr4.length);
                System.arraycopy(iArr3, 0, iArr2, iArr4.length, 8);
                iArr2[12] = i;
                System.arraycopy(iArr, 0, iArr2, 13, iArr.length);
                return iArr2;
            default:
                if (iArr.length != 6) {
                    throw new IllegalArgumentException(String.format("XChaCha20 uses 192-bit nonces, but got a %d-bit nonce", Integer.valueOf(iArr.length * 32)));
                }
                int[] iArr5 = new int[16];
                int[] iArrM5635 = AbstractC2052.m5635((int[]) this.f3452, iArr);
                int[] iArr6 = AbstractC2052.f8202;
                System.arraycopy(iArr6, 0, iArr5, 0, iArr6.length);
                System.arraycopy(iArrM5635, 0, iArr5, iArr6.length, 8);
                iArr5[12] = i;
                iArr5[13] = 0;
                iArr5[14] = iArr[4];
                iArr5[15] = iArr[5];
                return iArr5;
        }
    }

    @Override // defpackage.AbstractC0715
    /* renamed from: ᵝᵵᵺ */
    public final int mo2715() {
        switch (this.f15596) {
            case 0:
                return 12;
            default:
                return 24;
        }
    }
}
