CryptoUtilities.java :  » IDE » tIDE » snow » crypto » Java Open Source

Java Open Source » IDE » tIDE 
tIDE » snow » crypto » CryptoUtilities.java
package snow.crypto;

import java.io.*;
import java.math.*;
import java.net.*;
import java.security.*;
import java.security.spec.*;
import javax.crypto.spec.*;
import javax.crypto.*;

public final class CryptoUtilities
{
  private CryptoUtilities()
  {
  }

    public static byte[] MD5Hash(byte[] input)
    {
       try
       {
          MessageDigest md5 = MessageDigest.getInstance("MD5");
          return md5.digest(input);
       }
       catch(Exception e)
       {
          throw new RuntimeException(""+e.getMessage());
       }
    }

    public static byte[] SHA1Hash(byte[] input)
    {
       try
       {
          MessageDigest md = MessageDigest.getInstance("SHA1");
          return md.digest(input);
       }
       catch(Exception e)
       {
          throw new RuntimeException(""+e.getMessage());
       }
    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.