01: package snow.crypto;
02:
03: import java.io.*;
04: import java.math.*;
05: import java.net.*;
06: import java.security.*;
07: import java.security.spec.*;
08: import javax.crypto.spec.*;
09: import javax.crypto.*;
10:
11: public final class CryptoUtilities {
12: private CryptoUtilities() {
13: }
14:
15: public static byte[] MD5Hash(byte[] input) {
16: try {
17: MessageDigest md5 = MessageDigest.getInstance("MD5");
18: return md5.digest(input);
19: } catch (Exception e) {
20: throw new RuntimeException("" + e.getMessage());
21: }
22: }
23:
24: public static byte[] SHA1Hash(byte[] input) {
25: try {
26: MessageDigest md = MessageDigest.getInstance("SHA1");
27: return md.digest(input);
28: } catch (Exception e) {
29: throw new RuntimeException("" + e.getMessage());
30: }
31: }
32:
33: }
|