what-the-bank/sources/org/bouncycastle/crypto/StreamBlockCipher.java

39 lines
1.1 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.crypto;
/* loaded from: classes6.dex */
public abstract class StreamBlockCipher implements BlockCipher, StreamCipher {
private final BlockCipher cipher;
protected abstract byte calculateByte(byte b);
@Override // org.bouncycastle.crypto.StreamCipher
public final byte returnByte(byte b) {
return calculateByte(b);
}
@Override // org.bouncycastle.crypto.StreamCipher
public int processBytes(byte[] bArr, int i, int i2, byte[] bArr2, int i3) throws DataLengthException {
if (i3 + i2 > bArr2.length) {
throw new DataLengthException("output buffer too short");
}
int i4 = i + i2;
if (i4 > bArr.length) {
throw new DataLengthException("input buffer too small");
}
while (i < i4) {
bArr2[i3] = calculateByte(bArr[i]);
i3++;
i++;
}
return i2;
}
public BlockCipher getUnderlyingCipher() {
return this.cipher;
}
public StreamBlockCipher(BlockCipher blockCipher) {
this.cipher = blockCipher;
}
}