Gridarta Editor
net.sf.gridarta.utils.Xtea Class Reference
+ Collaboration diagram for net.sf.gridarta.utils.Xtea:

Public Member Functions

void decrypt (final byte @NotNull[] ciphertext, final byte @NotNull[] plaintext)
 
void encrypt (final byte @NotNull[] plaintext, final byte @NotNull[] ciphertext)
 
 Xtea (final byte @NotNull[] key)
 

Static Private Member Functions

static int getInt (final byte @NotNull[] data, final int offset)
 
static void putInt (final int value, final byte @NotNull[] data, final int offset)
 

Private Attributes

final int[] k = new int[4]
 

Static Private Attributes

static final int DELTA = 0x9E3779B9
 
static final int NUM_ROUNDS = 32
 

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 ( final byte @NotNull[]  key)

Creates a new instance.

Parameters
keythe key to use; must be 16 bytes

Definition at line 49 of file Xtea.java.

References net.sf.gridarta.utils.Xtea.getInt(), and net.sf.gridarta.utils.Xtea.k.

+ Here is the call graph for this function:

Member Function Documentation

◆ decrypt()

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

Decrypts a data block.

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

Definition at line 89 of file Xtea.java.

References net.sf.gridarta.utils.Xtea.DELTA, net.sf.gridarta.utils.Xtea.getInt(), net.sf.gridarta.utils.Xtea.k, 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 ( final byte @NotNull[]  plaintext,
final byte @NotNull[]  ciphertext 
)

Encrypts a data block.

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

Definition at line 65 of file Xtea.java.

References net.sf.gridarta.utils.Xtea.DELTA, net.sf.gridarta.utils.Xtea.getInt(), net.sf.gridarta.utils.Xtea.k, 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 ( final byte @NotNull[]  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 115 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,
final byte @NotNull[]  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 125 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

◆ 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: