SPT Core API

com.sptci.util
Class XOREncrypt

java.lang.Object
  extended by com.sptci.util.XOREncrypt

public class XOREncrypt
extends Object

A simple encrypter using the popular XOR technique.

© Copyright 2008 Sans Pareil Technologies, Inc.

Version:
$Id: XOREncrypt.java 4553 2008-12-24 10:34:16Z rakesh $
Author:
Rakesh Vidyadharan 2008-12-23

Constructor Summary
XOREncrypt()
          Create a new encrypter instance using the default encryption key.
XOREncrypt(String key)
          Create a new encrypter instance using the specified key to encrypt or decrypt data.
 
Method Summary
protected  byte[] crypt(byte[] value)
           
 String decrypt(byte[] value)
          Decrypt the encrypted value and return the original string value.
 byte[] encrypt(String value)
          Encrypt the specified string and return the array of bytes that represents the encrypted value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XOREncrypt

public XOREncrypt()
Create a new encrypter instance using the default encryption key.


XOREncrypt

public XOREncrypt(String key)
Create a new encrypter instance using the specified key to encrypt or decrypt data.

Parameters:
key - The key to use.
Method Detail

encrypt

public byte[] encrypt(String value)
Encrypt the specified string and return the array of bytes that represents the encrypted value.

Parameters:
value - The value to be encrypted.
Returns:
The array of encrypted bytes.
See Also:
crypt(byte[])

decrypt

public String decrypt(byte[] value)
Decrypt the encrypted value and return the original string value.

Parameters:
value - The encrypted bytes that are to be reconstituted.
Returns:
The original string value.

crypt

protected byte[] crypt(byte[] value)

SPT Core API