what-the-bank/sources/org/bouncycastle/crypto/io/DigestInputStream.java

39 lines
1.0 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.crypto.io;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.bouncycastle.crypto.Digest;
/* loaded from: classes6.dex */
public class DigestInputStream extends FilterInputStream {
protected Digest digest;
@Override // java.io.FilterInputStream, java.io.InputStream
public int read(byte[] bArr, int i, int i2) throws IOException {
int read = ((FilterInputStream) this).in.read(bArr, i, i2);
if (read > 0) {
this.digest.update(bArr, i, read);
}
return read;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public int read() throws IOException {
int read = ((FilterInputStream) this).in.read();
if (read >= 0) {
this.digest.update((byte) read);
}
return read;
}
public Digest getDigest() {
return this.digest;
}
public DigestInputStream(InputStream inputStream, Digest digest) {
super(inputStream);
this.digest = digest;
}
}