Package org.h2.security
Class XTEA
- java.lang.Object
-
- org.h2.security.XTEA
-
- All Implemented Interfaces:
BlockCipher
public class XTEA extends java.lang.Object implements BlockCipher
An implementation of the XTEA block cipher algorithm.This implementation uses 32 rounds. The best attack reported as of 2009 is 36 rounds (Wikipedia).
-
-
Field Summary
-
Fields inherited from interface org.h2.security.BlockCipher
ALIGN
-
-
Constructor Summary
Constructors Constructor Description XTEA()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddecrypt(byte[] bytes, int off, int len)Decrypt a number of bytes.voidencrypt(byte[] bytes, int off, int len)Encrypt a number of bytes.intgetKeyLength()Get the length of the key in bytes.voidsetKey(byte[] b)Set the encryption key used for encrypting and decrypting.
-
-
-
Method Detail
-
setKey
public void setKey(byte[] b)
Description copied from interface:BlockCipherSet the encryption key used for encrypting and decrypting. The key needs to be 16 bytes long.- Specified by:
setKeyin interfaceBlockCipher- Parameters:
b- the key
-
encrypt
public void encrypt(byte[] bytes, int off, int len)Description copied from interface:BlockCipherEncrypt a number of bytes. This is done in-place, that means the bytes are overwritten.- Specified by:
encryptin interfaceBlockCipher- Parameters:
bytes- the byte arrayoff- the start indexlen- the number of bytes to encrypt
-
decrypt
public void decrypt(byte[] bytes, int off, int len)Description copied from interface:BlockCipherDecrypt a number of bytes. This is done in-place, that means the bytes are overwritten.- Specified by:
decryptin interfaceBlockCipher- Parameters:
bytes- the byte arrayoff- the start indexlen- the number of bytes to decrypt
-
getKeyLength
public int getKeyLength()
Description copied from interface:BlockCipherGet the length of the key in bytes.- Specified by:
getKeyLengthin interfaceBlockCipher- Returns:
- the length of the key
-
-