org.mycore.user
Class MCRCrypt

java.lang.Object
  extended by org.mycore.user.MCRCrypt

public class MCRCrypt
extends Object

Java-based implementation of the unix crypt(3) command Based upon C source code written by Eric Young, eay@psych.uq.oz.au Java conversion by John F. Dumas, jdumas@zgs.com Found at http://locutus.kingwoodcable.com/jfd/crypt.html Minor optimizations by Wes Biggs, wes@cacas.org Adaption and extension for the MyCoRe Open Source System by Detlev Degenhardt, Detlev.Degenhardt@rz.uni-freiburg.de Eric's original code is licensed under the BSD license. As this is derivative, the same license applies.

Version:
$Revision: 13085 $ $Date: 2008-02-06 18:27:24 +0100 (Mi, 06 Feb 2008) $
Author:
Detlev Degenhardt

Field Summary
static String alphabet
           
 
Method Summary
static String crypt(String original)
          This method encrypts a string given the cleartext string.
static String crypt(String salt, String original)
          This method encrypts a string given a cleartext string and a "salt".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

alphabet

public static final String alphabet
See Also:
Constant Field Values
Method Detail

crypt

public static final String crypt(String salt,
                                 String original)
This method encrypts a string given a cleartext string and a "salt".

Parameters:
salt - A two-character string representing the salt used to iterate the encryption engine.
original - The string to be encrypted.
Returns:
A string consisting of the 2-character salt followed by the encrypted string.

crypt

public static final String crypt(String original)
This method encrypts a string given the cleartext string. A random salt is generated using java.util.Random.

Parameters:
original - The string to be encrypted.
Returns:
A string consisting of the 2-character salt followed by the encrypted string.