 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.utils;
22 import java.util.Arrays;
23 import org.jetbrains.annotations.NotNull;
24 import org.junit.Assert;
25 import org.junit.Test;
36 private static final byte @NotNull []
KEY = { (byte) 0x12, (
byte) 0x34, (byte) 0x56, (
byte) 0x78, (byte) 0x9a, (
byte) 0xbc, (byte) 0xde, (
byte) 0xf0, (byte) 0x01, (
byte) 0x23, (byte) 0x45, (
byte) 0x67, (byte) 0x89, (
byte) 0xab, (byte) 0xcd, (
byte) 0xef };
41 private static final byte @NotNull []
PLAINTEXT = { (byte) 0x01, (
byte) 0x02, (byte) 0x03, (
byte) 0x04, (byte) 0x05, (
byte) 0x06, (byte) 0x07, (
byte) 0x08 };
47 private static final byte @NotNull []
IPHERTEXT = { (byte) 0x06, (
byte) 0x6a, (byte) 0xb0, (
byte) 0x51, (byte) 0xf8, (
byte) 0xa7, (byte) 0xa3, (
byte) 0xc3 };
55 final byte[][] tmp =
new byte[2][8];
60 Assert.fail(
"encrypt failure");
64 Assert.fail(
"decrypt failure");
void encrypt(final byte @NotNull[] plaintext, final byte @NotNull[] ciphertext)
Encrypts a data block.
void decrypt(final byte @NotNull[] ciphertext, final byte @NotNull[] plaintext)
Decrypts a data block.
Regression tests for Xtea.
Implements the XTEA algorithm.
static final byte[] KEY
The key for the test.
static final byte[] PLAINTEXT
The plaintext for the test.
void test()
Checks that basic encryption and decryption works.
static final byte[] IPHERTEXT
The expected ciphertext corresponding to KEY and {}.