package org.bouncycastle.crypto;

/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.dex */
public abstract class StreamBlockCipher extends org.bouncycastle.crypto.DefaultMultiBlockCipher implements org.bouncycastle.crypto.StreamCipher {
    private final org.bouncycastle.crypto.BlockCipher a;

    protected StreamBlockCipher(org.bouncycastle.crypto.BlockCipher blockCipher) {
        this.a = blockCipher;
    }

    @Override // org.bouncycastle.crypto.StreamCipher
    public final byte e(byte b) {
        return f(b);
    }

    protected abstract byte f(byte b);

    public org.bouncycastle.crypto.BlockCipher getUnderlyingCipher() {
        return this.a;
    }

    @Override // org.bouncycastle.crypto.StreamCipher
    public int processBytes(byte[] bArr, int i, int i2, byte[] bArr2, int i3) {
        int i4 = i + i2;
        if (i4 > bArr.length) {
            throw new org.bouncycastle.crypto.DataLengthException("input buffer too small");
        }
        if (i3 + i2 > bArr2.length) {
            throw new org.bouncycastle.crypto.OutputLengthException("output buffer too short");
        }
        while (i < i4) {
            bArr2[i3] = f(bArr[i]);
            i3++;
            i++;
        }
        return i2;
    }
}
