package p421.p433.p434.p435;

import java.util.Random;
import net.lingala.zip4j.exception.ZipException;
import p421.p433.p434.p435.p437.C6782;

/* JADX INFO: renamed from: ޏ.ؠ.֏.ؠ.ބ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C6780 implements InterfaceC6775 {

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

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

    public C6780(char[] cArr, long j) throws ZipException {
        C6782 c6782 = new C6782();
        this.f19603 = c6782;
        this.f19604 = new byte[12];
        if (cArr == null || cArr.length <= 0) {
            throw new ZipException("input password is null or empty, cannot initialize standard encrypter");
        }
        c6782.m9941(cArr);
        byte[] bArr = new byte[12];
        Random random = new Random();
        for (int i = 0; i < 12; i++) {
            byte bNextInt = (byte) random.nextInt(256);
            byte bM9939 = (byte) ((this.f19603.m9939() & 255) ^ bNextInt);
            this.f19603.m9940(bNextInt);
            bArr[i] = bM9939;
        }
        this.f19604 = bArr;
        this.f19603.m9941(cArr);
        byte[] bArr2 = this.f19604;
        bArr2[11] = (byte) (j >>> 24);
        bArr2[10] = (byte) (j >>> 16);
        if (bArr2.length < 12) {
            throw new ZipException("invalid header bytes generated, cannot perform standard encryption");
        }
        mo9933(bArr2, 0, bArr2.length);
    }

    @Override // p421.p433.p434.p435.InterfaceC6775
    /* JADX INFO: renamed from: ֏ */
    public int mo9933(byte[] bArr, int i, int i2) throws ZipException {
        if (i2 < 0) {
            throw new ZipException("invalid length specified to decrpyt data");
        }
        for (int i3 = i; i3 < i + i2; i3++) {
            byte b = bArr[i3];
            byte bM9939 = (byte) ((this.f19603.m9939() & 255) ^ b);
            this.f19603.m9940(b);
            bArr[i3] = bM9939;
        }
        return i2;
    }
}
