games.strategy.util
Class MD5Crypt
java.lang.Object
games.strategy.util.MD5Crypt
public class MD5Crypt
- extends java.lang.Object
A Java Implementation of the MD5Crypt function
Modified from the GANYMEDE network directory management system
released under the GNU General Public License
by the University of Texas at Austin
http://tools.arlut.utexas.edu/gash2/
Original version from :Jonathan Abbey, jonabbey@arlut.utexas.edu
Modified by: Vladimir Silva, vladimir_silva@yahoo.com
Modification history:
9/2005
- Removed dependencies on a MD5 private implementation
- Added built-in java.security.MessageDigest (MD5) support
- Code cleanup
|
Field Summary |
static java.lang.String |
MAGIC
|
|
Method Summary |
static java.lang.String |
crypt(java.lang.String password)
LINUX/BSD MD5Crypt function |
static java.lang.String |
crypt(java.lang.String password,
java.lang.String salt)
LINUX/BSD MD5Crypt function |
static java.lang.String |
crypt(java.lang.String password,
java.lang.String salt,
java.lang.String magic)
Linux/BSD MD5Crypt function |
static java.lang.String |
getSalt(java.lang.String magic,
java.lang.String encrypted)
|
static void |
main(java.lang.String[] args)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MAGIC
public static final java.lang.String MAGIC
- See Also:
- Constant Field Values
MD5Crypt
public MD5Crypt()
crypt
public static final java.lang.String crypt(java.lang.String password)
- LINUX/BSD MD5Crypt function
- Parameters:
password - Password to be encrypted
- Returns:
- The encrypted password as an MD5 hash
crypt
public static final java.lang.String crypt(java.lang.String password,
java.lang.String salt)
- LINUX/BSD MD5Crypt function
- Parameters:
salt - Random string used to initialize the MD5 enginepassword - Password to be encrypted
- Returns:
- The encrypted password as an MD5 hash
crypt
public static final java.lang.String crypt(java.lang.String password,
java.lang.String salt,
java.lang.String magic)
- Linux/BSD MD5Crypt function
- Parameters:
magic - $1$ for Linux/BSB, $apr1$ for Apache cryptsalt - 8 byte permutation stringpassword - user password
- Returns:
- The encrypted password as an MD5 hash
- Throws:
java.lang.Exception
main
public static void main(java.lang.String[] args)
getSalt
public static java.lang.String getSalt(java.lang.String magic,
java.lang.String encrypted)