blob: 84b53ee3b73bead4c43e9978874e70d557d8f5b1 [file] [log] [blame]
Stuart McCullochbb014372012-06-07 21:57:32 +00001package aQute.libg.cryptography;
2
3import java.io.*;
4import java.security.*;
5
6
7
8public class MD5 extends Digest {
9 public final static String ALGORITHM = "MD5";
10
11 public static Digester<MD5> getDigester(OutputStream ... out) throws Exception {
12 return new Digester<MD5>(MessageDigest.getInstance(ALGORITHM), out) {
13
14 @Override public MD5 digest() throws Exception {
15 return new MD5(md.digest());
16 }
17
18 @Override public MD5 digest(byte[] bytes) {
19 return new MD5(bytes);
20 }
21 @Override public String getAlgorithm() {
22 return ALGORITHM;
23 }
24 };
25 }
26
27
28 public MD5(byte[] digest) {
29 super(digest,16);
30 }
31
32 @Override public String getAlgorithm() { return ALGORITHM; }
33
34}