Class CryptMD5
- java.lang.Object
-
- org.silverpeas.core.security.encryption.cipher.CryptMD5
-
public class CryptMD5 extends Object
The MD5 algorithm (Message Digest 5).It is a one-way hashing function that compute a 128-bit digest of a message (generally a file). It is not for encrypting password but for generating a digest of a content in order to sign it and to ensure its integrity.
A first flaw (possibility to create collisions at the demand) was discovered in 1996. In 2004, a chinese team broke it by discovering full collisions. Since, it was replaced first by the SHA-1 algorithm and now the SHA-2 algorithms are used (SHA-256, SHA-512).
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
encrypt(File file)
Computes the MD5 hash of a file.static String
encrypt(String original)
Encrypts the specified text in MD5.
-
-
-
Method Detail
-
encrypt
public static String encrypt(String original) throws SilverpeasRuntimeException
Encrypts the specified text in MD5.- Parameters:
original
- the text to encrypt- Returns:
- the digest of the text in a 32-bits hexadecimal.
- Throws:
SilverpeasRuntimeException
- if an error occurs.
-
encrypt
public static String encrypt(File file) throws SilverpeasRuntimeException
Computes the MD5 hash of a file.- Parameters:
file
- the file to be MD5 hashed.- Returns:
- the MD5 hash as a String.
- Throws:
SilverpeasRuntimeException
- if an error occurs.
-
-