blob: a01f1127111f3bca97759a0a35e3c3374a1b2ccc [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 SHA1 extends Digest {
9 public final static String ALGORITHM = "SHA1";
10
11
12 public static Digester<SHA1> getDigester(OutputStream ... out ) throws NoSuchAlgorithmException {
13 MessageDigest md = MessageDigest.getInstance(ALGORITHM);
14 return new Digester<SHA1>(md, out) {
15 @Override public SHA1 digest() throws Exception {
16 return new SHA1(md.digest());
17 }
18
19 @Override public SHA1 digest(byte[] bytes) {
20 return new SHA1(bytes);
21 }
22 @Override public String getAlgorithm() {
23 return ALGORITHM;
24 }
25 };
26 }
27
28 public SHA1(byte[] b) {
29 super(b, 20);
30 }
31
32
33 @Override public String getAlgorithm() { return ALGORITHM; }
34
35}