org.opensourcephysics.controls
Class Cryptic

java.lang.Object
  extended by org.opensourcephysics.controls.Cryptic

public class Cryptic
extends java.lang.Object

A class to represent an encrypted version of a UTF-8-encoded String.

Version:
1.0 May 2006
Author:
Doug Brown

Constructor Summary
protected Cryptic()
          Protected no-arg constructor has null cryptic.
  Cryptic(java.lang.String input)
          Public constructor with input string.
  Cryptic(java.lang.String input, java.lang.String password)
          Public constructor with input and password.
 
Method Summary
 java.lang.String decrypt()
          Gets the decrypted string.
 java.lang.String decrypt(java.lang.String password)
          Gets the decrypted string using a password.
 java.lang.String encrypt(java.lang.String content)
          Encrypts the input and saves in cryptic form.
 java.lang.String encrypt(java.lang.String content, java.lang.String password)
          Encrypts the input with a password and saves in cryptic form.
 java.lang.String getCryptic()
          Gets the cryptic.
static XML.ObjectLoader getLoader()
          Returns an ObjectLoader to save and load data for this class.
 void setCryptic(java.lang.String encrypted)
          Sets the cryptic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cryptic

protected Cryptic()
Protected no-arg constructor has null cryptic.


Cryptic

public Cryptic(java.lang.String input)
Public constructor with input string.

Parameters:
input - UTF-8 String to encrypt

Cryptic

public Cryptic(java.lang.String input,
               java.lang.String password)
Public constructor with input and password.

Parameters:
input - UTF-8 String to encrypt
password -
Method Detail

encrypt

public java.lang.String encrypt(java.lang.String content)
Encrypts the input and saves in cryptic form.

Parameters:
input - UTF-8 String to encrypt
Returns:
the encrypted content

encrypt

public java.lang.String encrypt(java.lang.String content,
                                java.lang.String password)
Encrypts the input with a password and saves in cryptic form.

Parameters:
input - UTF-8 String to encrypt
Returns:
the encrypted content

decrypt

public java.lang.String decrypt()
Gets the decrypted string.

Returns:
the decrypted string

decrypt

public java.lang.String decrypt(java.lang.String password)
Gets the decrypted string using a password.

Parameters:
password - the password
Returns:
the decrypted string

getCryptic

public java.lang.String getCryptic()
Gets the cryptic.

Returns:
the encrypted version of the input

setCryptic

public void setCryptic(java.lang.String encrypted)
Sets the cryptic.

Parameters:
encrypted - an encrypted string

getLoader

public static XML.ObjectLoader getLoader()
Returns an ObjectLoader to save and load data for this class.

Returns:
the object loader