com.vividsolutions.jump.util
Class SimpleStringEncrypter

java.lang.Object
  extended by com.vividsolutions.jump.util.SimpleStringEncrypter

public class SimpleStringEncrypter
extends java.lang.Object

Provides a simple encyrption/decryption mechanism for ASCII string values. The algorithm does not provide strong encryption, but serves as a way of obfuscating the value of short strings (such as passwords). The code symbol set is drawn from the set of printable ASCII symbols. The encrypted strings are longer than the clear text (roughly double in length). A random element is used, so that different encryptions of the same clear text will result in different encodings.


Constructor Summary
SimpleStringEncrypter()
          Creates a new encrypter
 
Method Summary
 java.lang.String decrypt(java.lang.String codeText)
          Decrypts a code string.
 java.lang.String encrypt(java.lang.String clearText)
          Encrypts a string.
 void setEncryptedSymbol(char c, char[] code, int i)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleStringEncrypter

public SimpleStringEncrypter()
Creates a new encrypter

Method Detail

encrypt

public java.lang.String encrypt(java.lang.String clearText)
Encrypts a string.

Parameters:
clearText - the string to encrypt
Returns:
the encryted code

setEncryptedSymbol

public void setEncryptedSymbol(char c,
                               char[] code,
                               int i)

decrypt

public java.lang.String decrypt(java.lang.String codeText)
Decrypts a code string.

Parameters:
codeText - the code to decrypt
Returns:
the clear text for the code
Throws:
java.lang.IllegalArgumentException - if the code string is invalid