Class Vernam

java.lang.Object
  extended by AbstractCodingDevice
      extended by Vernam
All Implemented Interfaces:
CodingDevice

public class Vernam
extends AbstractCodingDevice

Implements Vernam's coding algorithm

Version:
29 10 2009
Author:
Tomas Sedmik

Constructor Summary
Vernam(String key)
          Constructor that sets the key used for encoding/decoding
 
Method Summary
 String decode(String text)
          Decode a message
 String encode(String text)
          Encode a message
 
Methods inherited from class AbstractCodingDevice
getKey, setKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Vernam

public Vernam(String key)
Constructor that sets the key used for encoding/decoding

Parameters:
key - the key used for encoding/decoding.
Method Detail

decode

public String decode(String text)
Decode a message

Specified by:
decode in interface CodingDevice
Specified by:
decode in class AbstractCodingDevice
Parameters:
text - message which will be decoded
Returns:
decoded text

encode

public String encode(String text)
Encode a message

Specified by:
encode in interface CodingDevice
Specified by:
encode in class AbstractCodingDevice
Parameters:
text - message which will be encoded
Returns:
encoded text