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