org.silverpeas.util.crypto
Class CryptMD5
java.lang.Object
org.silverpeas.util.crypto.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).
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CryptMD5
public CryptMD5()
encrypt
public static String encrypt(String original)
throws UtilException
- Encrypts the specified text in MD5.
- Parameters:
original
- the text to encrypt
- Returns:
- the digest of the text in a 32-bits hexadecimal.
- Throws:
UtilException
encrypt
public static String encrypt(File file)
throws UtilException
- Computes the MD5 hash of a file.
- Parameters:
file
- the file to be MD5 hashed.
- Returns:
- the MD5 hash as a String.
- Throws:
UtilException
Copyright © 2016 Silverpeas. All Rights Reserved.