public final class EncryptionXTEA
extends java.lang.Object
This implementation uses 32 rounds. The best attack reported as of 2009 is 36 rounds (Wikipedia).
It requires 32 byte long encryption key, so SHA256 password hash is used.| Modifier and Type | Field and Description |
|---|---|
static int |
ALIGN
Blocks sizes are always multiples of this number.
|
private static int |
DELTA |
private static int[] |
K
The first 32 bits of the fractional parts of the cube roots of the first
sixty-four prime numbers.
|
private int |
k0 |
private int |
k1 |
private int |
k10 |
private int |
k11 |
private int |
k12 |
private int |
k13 |
private int |
k14 |
private int |
k15 |
private int |
k16 |
private int |
k17 |
private int |
k18 |
private int |
k19 |
private int |
k2 |
private int |
k20 |
private int |
k21 |
private int |
k22 |
private int |
k23 |
private int |
k24 |
private int |
k25 |
private int |
k26 |
private int |
k27 |
private int |
k28 |
private int |
k29 |
private int |
k3 |
private int |
k30 |
private int |
k31 |
private int |
k4 |
private int |
k5 |
private int |
k6 |
private int |
k7 |
private int |
k8 |
private int |
k9 |
| Constructor and Description |
|---|
EncryptionXTEA(byte[] password) |
| Modifier and Type | Method and Description |
|---|---|
void |
decrypt(byte[] bytes,
int off,
int len) |
private void |
decryptBlock(byte[] in,
byte[] out,
int off) |
void |
encrypt(byte[] bytes,
int off,
int len) |
private void |
encryptBlock(byte[] in,
byte[] out,
int off) |
static byte[] |
getHash(byte[] data)
Calculate the hash code for the given data.
|
private static int |
readInt(byte[] b,
int i) |
private static int |
rot(int i,
int count) |
private static void |
writeInt(byte[] b,
int i,
int value) |
public static final int ALIGN
private static final int DELTA
private final int k0
private final int k1
private final int k2
private final int k3
private final int k4
private final int k5
private final int k6
private final int k7
private final int k8
private final int k9
private final int k10
private final int k11
private final int k12
private final int k13
private final int k14
private final int k15
private final int k16
private final int k17
private final int k18
private final int k19
private final int k20
private final int k21
private final int k22
private final int k23
private final int k24
private final int k25
private final int k26
private final int k27
private final int k28
private final int k29
private final int k30
private final int k31
private static final int[] K
public void encrypt(byte[] bytes,
int off,
int len)
public void decrypt(byte[] bytes,
int off,
int len)
private void encryptBlock(byte[] in,
byte[] out,
int off)
private void decryptBlock(byte[] in,
byte[] out,
int off)
public static byte[] getHash(byte[] data)
data - the data to hashprivate static int rot(int i,
int count)
private static int readInt(byte[] b,
int i)
private static void writeInt(byte[] b,
int i,
int value)