• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.bouncycastle.crypto.digests;
2 
3 import java.io.ByteArrayOutputStream;
4 
5 import org.bouncycastle.crypto.Digest;
6 
7 
8 public class NullDigest
9     implements Digest
10 {
11     private ByteArrayOutputStream bOut = new ByteArrayOutputStream();
12 
getAlgorithmName()13     public String getAlgorithmName()
14     {
15         return "NULL";
16     }
17 
getDigestSize()18     public int getDigestSize()
19     {
20         return bOut.size();
21     }
22 
update(byte in)23     public void update(byte in)
24     {
25         bOut.write(in);
26     }
27 
update(byte[] in, int inOff, int len)28     public void update(byte[] in, int inOff, int len)
29     {
30         bOut.write(in, inOff, len);
31     }
32 
doFinal(byte[] out, int outOff)33     public int doFinal(byte[] out, int outOff)
34     {
35         byte[] res = bOut.toByteArray();
36 
37         System.arraycopy(res, 0, out, outOff, res.length);
38 
39         reset();
40 
41         return res.length;
42     }
43 
reset()44     public void reset()
45     {
46         bOut.reset();
47     }
48 }