package aQute.libg.cryptography;

import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class SHA1 extends Digest {
	public final static String ALGORITHM = "SHA-1";

	public static Digester<SHA1> getDigester(OutputStream... out) throws NoSuchAlgorithmException {
		MessageDigest md = MessageDigest.getInstance(ALGORITHM);
		return new Digester<SHA1>(md, out) {
			@Override
			public SHA1 digest() throws Exception {
				return new SHA1(md.digest());
			}

			@Override
			public SHA1 digest(byte[] bytes) {
				return new SHA1(bytes);
			}

			@Override
			public String getAlgorithm() {
				return ALGORITHM;
			}
		};
	}

	public SHA1(byte[] b) {
		super(b, 20);
	}

	@Override
	public String getAlgorithm() {
		return ALGORITHM;
	}

	public static SHA1 digest(byte[] data) throws Exception {
		return getDigester().from(data);
	}

	public static SHA1 digest(File f) throws NoSuchAlgorithmException, Exception {
		return getDigester().from(f);
	}

	public static SHA1 digest(InputStream f) throws NoSuchAlgorithmException, Exception {
		return getDigester().from(f);
	}
}

@@ -189,16 +189,57 @@
 ption;%0A%0A
+import aQute.lib.exceptions.Exceptions;%0A%0A
 public c
@@ -382,42 +382,19 @@
 ut) 
-throws NoSuchAlgorithmException
+%7B%0A%09%09try
  %7B%0A
+%09
 %09%09Me
@@ -450,16 +450,17 @@
 THM);%0A%09%09
+%09
 return n
@@ -488,16 +488,17 @@
  out) %7B%0A
+%09
 %09%09%09@Over
@@ -497,32 +497,33 @@
 %09%09%09@Override%0A%09%09%09
+%09
 public SHA1 dige
@@ -546,16 +546,17 @@
 ption %7B%0A
+%09
 %09%09%09%09retu
@@ -580,27 +580,29 @@
 gest());%0A%09%09%09
+%09
 %7D%0A%0A
+%09
 %09%09%09@Override
@@ -594,32 +594,33 @@
 %0A%0A%09%09%09%09@Override%0A
+%09
 %09%09%09public SHA1 d
@@ -637,24 +637,25 @@
 %5B%5D bytes) %7B%0A
+%09
 %09%09%09%09return n
@@ -673,19 +673,21 @@
 es);%0A%09%09%09
+%09
 %7D%0A%0A
+%09
 %09%09%09@Over
@@ -691,16 +691,17 @@
 verride%0A
+%09
 %09%09%09publi
@@ -722,24 +722,25 @@
 gorithm() %7B%0A
+%09
 %09%09%09%09return A
@@ -756,15 +756,91 @@
 %0A%09%09%09
+%09
 %7D%0A
+%09
 %09%09%7D;%0A
+%09%09%7D catch (NoSuchAlgorithmException e) %7B%0A%09%09%09throw Exceptions.duck(e);%0A%09%09%7D%0A
 %09%7D%0A%0A

Remove exception