package org.bouncycastle.crypto.digests;

/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.dex */
public class NullDigest implements org.bouncycastle.crypto.Digest {
    private org.bouncycastle.crypto.digests.NullDigest.OpenByteArrayOutputStream a = new org.bouncycastle.crypto.digests.NullDigest.OpenByteArrayOutputStream();

    private static class OpenByteArrayOutputStream extends java.io.ByteArrayOutputStream {
        private OpenByteArrayOutputStream() {
        }

        void a(byte[] bArr, int i) {
            java.lang.System.arraycopy(((java.io.ByteArrayOutputStream) this).buf, 0, bArr, i, size());
        }

        @Override // java.io.ByteArrayOutputStream
        public void reset() {
            super.reset();
            org.bouncycastle.util.Arrays.i(((java.io.ByteArrayOutputStream) this).buf);
        }
    }

    @Override // org.bouncycastle.crypto.Digest
    public int doFinal(byte[] bArr, int i) {
        int size = this.a.size();
        this.a.a(bArr, i);
        reset();
        return size;
    }

    @Override // org.bouncycastle.crypto.Digest
    public java.lang.String getAlgorithmName() {
        return "NULL";
    }

    @Override // org.bouncycastle.crypto.Digest
    public int getDigestSize() {
        return this.a.size();
    }

    @Override // org.bouncycastle.crypto.Digest
    public void reset() {
        this.a.reset();
    }

    @Override // org.bouncycastle.crypto.Digest
    public void update(byte b) throws java.io.IOException {
        this.a.write(b);
    }

    @Override // org.bouncycastle.crypto.Digest
    public void update(byte[] bArr, int i, int i2) throws java.io.IOException {
        this.a.write(bArr, i, i2);
    }
}
