Class HashGenerator
- java.lang.Object
-
- net.sourceforge.jbizmo.commons.crypto.HashGenerator
-
public class HashGenerator extends Object
Utility class for encrypting a text by using MD5 or SHA-256
Copyright 2011 (C) by Martin Ganserer
- Version:
- 1.0.0
- Author:
- Martin Ganserer
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Stringencrypt(String text, String digester, Charset charset)Perform encryption of the given textstatic StringencryptMD5(String text)Perform encryption of the given text by using MD5static StringencryptSHA256(String text)Perform encryption of the given text by using SHA-256
-
-
-
Method Detail
-
encryptMD5
public static String encryptMD5(String text) throws NoSuchAlgorithmException
Perform encryption of the given text by using MD5- Parameters:
text-- Returns:
- the encrypted text in hex format
- Throws:
NoSuchAlgorithmException- if the selected algorithm doesn't exist
-
encryptSHA256
public static String encryptSHA256(String text) throws NoSuchAlgorithmException
Perform encryption of the given text by using SHA-256- Parameters:
text-- Returns:
- the encrypted text in hex format
- Throws:
NoSuchAlgorithmException- if the selected algorithm doesn't exist
-
encrypt
public static String encrypt(String text, String digester, Charset charset) throws NoSuchAlgorithmException
Perform encryption of the given text- Parameters:
text-digester-charset-- Returns:
- the encrypted text in hex format
- Throws:
NoSuchAlgorithmException- if the selected algorithm doesn't exist
-
-