Class HashGenerator
java.lang.Object
net.sourceforge.jbizmo.commons.crypto.HashGenerator
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
Modifier and TypeMethodDescriptionstatic StringPerform 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 Details
-
encryptMD5
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
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
-