1
package org.bouncycastle.crypto.tls;
3
import org.bouncycastle.crypto.Digest;
4
import org.bouncycastle.crypto.digests.MD5Digest;
5
import org.bouncycastle.crypto.digests.SHA1Digest;
8
* A combined hash, which implements md5(m) || sha1(m).
10
class CombinedHash implements Digest
12
private MD5Digest md5;
13
private SHA1Digest sha1;
17
this.md5 = new MD5Digest();
18
this.sha1 = new SHA1Digest();
21
CombinedHash(CombinedHash t)
23
this.md5 = new MD5Digest(t.md5);
24
this.sha1 = new SHA1Digest(t.sha1);
28
* @see org.bouncycastle.crypto.Digest#getAlgorithmName()
30
public String getAlgorithmName()
32
return md5.getAlgorithmName() + " and " + sha1.getAlgorithmName() + " for TLS 1.0";
36
* @see org.bouncycastle.crypto.Digest#getDigestSize()
38
public int getDigestSize()
44
* @see org.bouncycastle.crypto.Digest#update(byte)
46
public void update(byte in)
53
* @see org.bouncycastle.crypto.Digest#update(byte[],int,int)
55
public void update(byte[] in, int inOff, int len)
57
md5.update(in, inOff, len);
58
sha1.update(in, inOff, len);
62
* @see org.bouncycastle.crypto.Digest#doFinal(byte[],int)
64
public int doFinal(byte[] out, int outOff)
66
int i1 = md5.doFinal(out, outOff);
67
int i2 = sha1.doFinal(out, outOff + 16);
72
* @see org.bouncycastle.crypto.Digest#reset()