org.productivity.java.habitat4j.junit.examples.decryptor
Class SampleCaesarEncryptorDecryptor
java.lang.Object
org.productivity.java.habitat4j.junit.examples.decryptor.SampleCaesarEncryptorDecryptor
- All Implemented Interfaces:
- DecryptorIF
public class SampleCaesarEncryptorDecryptor
- extends java.lang.Object
- implements DecryptorIF
This sample encryptor/decryptor class implements a simple Caesar cipher, where
the letters of the alphabet are mapped 1 character over. For instance, to
"encrypt," a becomes b, b becomes c, ..., and z becomes a. In order to
"decrypt," z becomes y, y becomes x, ..., and a becomes z.
## LICENSE INFORMATION ##
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
- Version:
- $Id: SampleCaesarEncryptorDecryptor.html,v 1.2 2008/11/24 15:15:20 cvs Exp $
- Author:
- Justin Yunke <habitat4j@productivity.org>
|
Method Summary |
java.lang.String |
decrypt(java.lang.String propertyListName,
java.lang.String name,
java.lang.String value)
|
static java.lang.String |
doCaesar(java.lang.String value,
boolean encrypt)
|
void |
initialize(java.lang.String appName,
java.lang.String propertyListName)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SampleCaesarEncryptorDecryptor
public SampleCaesarEncryptorDecryptor()
initialize
public void initialize(java.lang.String appName,
java.lang.String propertyListName)
- Specified by:
initialize in interface DecryptorIF
- Parameters:
appName - - the name of the calling application (use is optional)propertyListName - - the name of the PropertyList that's calling this method (use is optional)
decrypt
public java.lang.String decrypt(java.lang.String propertyListName,
java.lang.String name,
java.lang.String value)
- Specified by:
decrypt in interface DecryptorIF
- Parameters:
propertyListName - - the name of the PropertyList that's calling this method (use is optional)name - - the Property name (use is optional)value - - the String value to decrypt
- Returns:
- Returns a decrypted String from parameter "value"
doCaesar
public static java.lang.String doCaesar(java.lang.String value,
boolean encrypt)
- Parameters:
value - - the data to encrypt/decryptencrypt - - whether to encrypt (true) or decrypt (false)
- Returns:
- Returns the result of a Caesar cipher.