Gridarta Editor
net.sf.gridarta.utils.Xtea Class Reference

Implements the XTEA algorithm. More...

+ Collaboration diagram for net.sf.gridarta.utils.Xtea:

Public Member Functions

void decrypt (@NotNull final byte[] ciphertext, @NotNull final byte[] plaintext)
 Decrypts a data block. More...
 
void encrypt (@NotNull final byte[] plaintext, @NotNull final byte[] ciphertext)
 Encrypts a data block. More...
 
 Xtea (@NotNull final byte[] key)
 Creates a new instance. More...
 

Static Private Member Functions

static int getInt (@NotNull final byte[] data, final int offset)
 Converts 4 data bytes to an. More...
 
static void putInt (final int value, @NotNull final byte[] data, final int offset)
 Converts an. More...
 

Private Attributes

final int [] k = new int[4]
 The state. More...
 

Static Private Attributes

static final int DELTA = 0x9E3779B9
 The magic constant (1<<32)/PHI. More...
 
static final int NUM_ROUNDS = 32
 The number of rounds. More...
 

Detailed Description

Implements the XTEA algorithm.

Author
Andreas Kirschbaum

Definition at line 28 of file Xtea.java.

Constructor & Destructor Documentation

◆ Xtea()

net.sf.gridarta.utils.Xtea.Xtea ( @NotNull final byte []  key)

Creates a new instance.

Parameters
keythe key to use; must be 16 bytes

Definition at line 50 of file Xtea.java.

References net.sf.gridarta.utils.Xtea.getInt().

+ Here is the call graph for this function:

Member Function Documentation

◆ decrypt()

void net.sf.gridarta.utils.Xtea.decrypt ( @NotNull final byte []  ciphertext,
@NotNull final byte []  plaintext 
)

Decrypts a data block.

Parameters
ciphertextthe block to decrypt; must be 8 bytes
plaintextthe decrypted block; must be 8 bytes

Definition at line 90 of file Xtea.java.

References net.sf.gridarta.utils.Xtea.DELTA, net.sf.gridarta.utils.Xtea.getInt(), net.sf.gridarta.utils.Xtea.NUM_ROUNDS, and net.sf.gridarta.utils.Xtea.putInt().

Referenced by net.sf.gridarta.utils.XteaTest.test().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ encrypt()

void net.sf.gridarta.utils.Xtea.encrypt ( @NotNull final byte []  plaintext,
@NotNull final byte []  ciphertext 
)

Encrypts a data block.

Parameters
plaintextthe block to encrypt; must be 8 bytes
ciphertextthe encrypted block; must be 8 bytes

Definition at line 66 of file Xtea.java.

References net.sf.gridarta.utils.Xtea.DELTA, net.sf.gridarta.utils.Xtea.getInt(), net.sf.gridarta.utils.Xtea.NUM_ROUNDS, and net.sf.gridarta.utils.Xtea.putInt().

Referenced by net.sf.gridarta.model.index.MapsIndexer< G, A, R >.getCacheFile(), and net.sf.gridarta.utils.XteaTest.test().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInt()

static int net.sf.gridarta.utils.Xtea.getInt ( @NotNull final byte []  data,
final int  offset 
)
staticprivate

Converts 4 data bytes to an.

int

.

Parameters
datathe data array
offsetthe starting offset into
data
Returns
the
int
value

Definition at line 116 of file Xtea.java.

Referenced by net.sf.gridarta.utils.Xtea.decrypt(), net.sf.gridarta.utils.Xtea.encrypt(), and net.sf.gridarta.utils.Xtea.Xtea().

+ Here is the caller graph for this function:

◆ putInt()

static void net.sf.gridarta.utils.Xtea.putInt ( final int  value,
@NotNull final byte []  data,
final int  offset 
)
staticprivate

Converts an.

int

value into 4 data bytes.

Parameters
valuethe
int
value
datathe data array
offsetthe starting offset into
data

Definition at line 126 of file Xtea.java.

Referenced by net.sf.gridarta.utils.Xtea.decrypt(), and net.sf.gridarta.utils.Xtea.encrypt().

+ Here is the caller graph for this function:

Member Data Documentation

◆ DELTA

final int net.sf.gridarta.utils.Xtea.DELTA = 0x9E3779B9
staticprivate

The magic constant (1<<32)/PHI.

Definition at line 38 of file Xtea.java.

Referenced by net.sf.gridarta.utils.Xtea.decrypt(), and net.sf.gridarta.utils.Xtea.encrypt().

◆ k

final int [] net.sf.gridarta.utils.Xtea.k = new int[4]
private

The state.

Definition at line 44 of file Xtea.java.

◆ NUM_ROUNDS

final int net.sf.gridarta.utils.Xtea.NUM_ROUNDS = 32
staticprivate

The number of rounds.

Definition at line 33 of file Xtea.java.

Referenced by net.sf.gridarta.utils.Xtea.decrypt(), and net.sf.gridarta.utils.Xtea.encrypt().


The documentation for this class was generated from the following file: