package org.bouncycastle.crypto.io; import java.io.IOException; import java.io.OutputStream; import org.bouncycastle.crypto.Digest; /* loaded from: classes6.dex */ public class DigestOutputStream extends OutputStream { protected Digest digest; @Override // java.io.OutputStream public void write(byte[] bArr, int i, int i2) throws IOException { this.digest.update(bArr, i, i2); } @Override // java.io.OutputStream public void write(int i) throws IOException { this.digest.update((byte) i); } public byte[] getDigest() { byte[] bArr = new byte[this.digest.getDigestSize()]; this.digest.doFinal(bArr, 0); return bArr; } public DigestOutputStream(Digest digest) { this.digest = digest; } }