Quadcap Embeddable Database

com.quadcap.crypto.Tea256 Class Reference

Inheritance diagram for com.quadcap.crypto.Tea256:

com.quadcap.crypto.AbstractSymmetricKey com.quadcap.crypto.SymmetricKey com.quadcap.crypto.SymmetricKey List of all members.

Detailed Description

Implementation of Tiny Encryption Algorithm, modified to use longs instead of ints.

SO the key is now four longs, or 256 bits, and the encryption/decryption proceeds 16 bytes at a time instead of 8.

The number of rounds has been retained at 32.

Author:
Stan Bailes

Definition at line 58 of file Tea256.java.

Public Member Functions

void init (String s)
 Initialize key from serialized representation.

void init (byte[] k)
void init (Random r)
 Initialize: Create a random key.

String toString ()
 Return the serialized form of the key.

void encrypt (ByteBuffer plain, ByteBuffer code)
 Encrypt a buffer (must be multiple of 16 bytes).

void decrypt (ByteBuffer code, ByteBuffer plain)
 Decrypt a buffer (must be a multiple of 16 bytes).

int getBlockSize ()
 The key's block size.


Package Functions

final void encrypt (long[] v)
final void decrypt (long[] v)

Package Attributes

long a
long b
long c
long d
long[] v = new long[2]

Static Package Attributes

final long delta = 0x9E3779B97F4A7C15L
 Computed as (sqrt(5)-1) * 2**63, following original Tea choice of delta.

final int rounds = 32


Member Function Documentation

final void com.quadcap.crypto.Tea256.decrypt long[]  v  )  [package]
 

Definition at line 148 of file Tea256.java.

References com.quadcap.crypto.Tea256.b, com.quadcap.crypto.Tea256.d, com.quadcap.crypto.Tea256.delta, and com.quadcap.crypto.Tea256.rounds.

void com.quadcap.crypto.Tea256.decrypt ByteBuffer  code,
ByteBuffer  plain
[virtual]
 

Decrypt a buffer (must be a multiple of 16 bytes).

Implements com.quadcap.crypto.AbstractSymmetricKey.

Definition at line 120 of file Tea256.java.

References com.quadcap.crypto.Tea256.decrypt(), and com.quadcap.crypto.Tea256.v.

Referenced by com.quadcap.crypto.Tea256.decrypt().

final void com.quadcap.crypto.Tea256.encrypt long[]  v  )  [package]
 

Definition at line 134 of file Tea256.java.

References com.quadcap.crypto.Tea256.b, com.quadcap.crypto.Tea256.d, com.quadcap.crypto.Tea256.delta, and com.quadcap.crypto.Tea256.rounds.

void com.quadcap.crypto.Tea256.encrypt ByteBuffer  plain,
ByteBuffer  code
[virtual]
 

Encrypt a buffer (must be multiple of 16 bytes).

Implements com.quadcap.crypto.AbstractSymmetricKey.

Definition at line 105 of file Tea256.java.

References com.quadcap.crypto.Tea256.encrypt(), and com.quadcap.crypto.Tea256.v.

Referenced by com.quadcap.crypto.Tea256.encrypt().

int com.quadcap.crypto.Tea256.getBlockSize  )  [virtual]
 

The key's block size.

Implements com.quadcap.crypto.AbstractSymmetricKey.

Definition at line 132 of file Tea256.java.

void com.quadcap.crypto.Tea256.init Random  r  )  [virtual]
 

Initialize: Create a random key.

Implements com.quadcap.crypto.AbstractSymmetricKey.

Definition at line 88 of file Tea256.java.

References com.quadcap.crypto.Tea256.a, com.quadcap.crypto.Tea256.b, com.quadcap.crypto.Tea256.c, and com.quadcap.crypto.Tea256.d.

void com.quadcap.crypto.Tea256.init byte[]  k  ) 
 

Definition at line 78 of file Tea256.java.

References com.quadcap.crypto.Tea256.a, com.quadcap.crypto.Tea256.b, com.quadcap.crypto.Tea256.c, and com.quadcap.crypto.Tea256.d.

void com.quadcap.crypto.Tea256.init String  s  )  [virtual]
 

Initialize key from serialized representation.

Implements com.quadcap.crypto.AbstractSymmetricKey.

Definition at line 70 of file Tea256.java.

References com.quadcap.crypto.Tea256.a, com.quadcap.crypto.Tea256.b, com.quadcap.crypto.Tea256.c, com.quadcap.crypto.Tea256.d, and com.quadcap.crypto.Tea256.init().

Referenced by com.quadcap.crypto.KeyFactory.createSymmetricKey(), and com.quadcap.crypto.Tea256.init().

String com.quadcap.crypto.Tea256.toString  ) 
 

Return the serialized form of the key.

Implements com.quadcap.crypto.SymmetricKey.

Definition at line 98 of file Tea256.java.

References com.quadcap.crypto.Tea256.a, com.quadcap.crypto.Tea256.b, com.quadcap.crypto.Tea256.c, and com.quadcap.crypto.Tea256.d.


Member Data Documentation

long com.quadcap.crypto.Tea256.a [package]
 

Definition at line 64 of file Tea256.java.

Referenced by com.quadcap.crypto.Tea256.init(), and com.quadcap.crypto.Tea256.toString().

long com.quadcap.crypto.Tea256.b [package]
 

Definition at line 64 of file Tea256.java.

Referenced by com.quadcap.crypto.Tea256.decrypt(), com.quadcap.crypto.Tea256.encrypt(), com.quadcap.crypto.Tea256.init(), and com.quadcap.crypto.Tea256.toString().

long com.quadcap.crypto.Tea256.c [package]
 

Definition at line 64 of file Tea256.java.

Referenced by com.quadcap.crypto.Tea256.init(), and com.quadcap.crypto.Tea256.toString().

long com.quadcap.crypto.Tea256.d [package]
 

Definition at line 64 of file Tea256.java.

Referenced by com.quadcap.crypto.Tea256.decrypt(), com.quadcap.crypto.Tea256.encrypt(), com.quadcap.crypto.Tea256.init(), and com.quadcap.crypto.Tea256.toString().

final long com.quadcap.crypto.Tea256.delta = 0x9E3779B97F4A7C15L [static, package]
 

Computed as (sqrt(5)-1) * 2**63, following original Tea choice of delta.

Definition at line 61 of file Tea256.java.

Referenced by com.quadcap.crypto.Tea256.decrypt(), and com.quadcap.crypto.Tea256.encrypt().

final int com.quadcap.crypto.Tea256.rounds = 32 [static, package]
 

Definition at line 62 of file Tea256.java.

Referenced by com.quadcap.crypto.Tea256.decrypt(), and com.quadcap.crypto.Tea256.encrypt().

long [] com.quadcap.crypto.Tea256.v = new long[2] [package]
 

Definition at line 65 of file Tea256.java.

Referenced by com.quadcap.crypto.Tea256.decrypt(), and com.quadcap.crypto.Tea256.encrypt().