public class Threefish extends BlockCipher
| Modifier and Type | Field and Description |
|---|---|
static int |
BLOCK_SIZE_BITS_1024 |
static int |
BLOCK_SIZE_BITS_256 |
static int |
BLOCK_SIZE_BITS_512 |
blockSizeInBytes, TERMINATOR| Constructor and Description |
|---|
Threefish(int blockSize)
Threefish implementation using the specified blocksize in bits.
|
Threefish(int blockSize,
int rounds)
Threefish implementation using the specified blocksize in bits, specifying the number of rounds directly instead
of using the default number of rounds depending on the blockSize.
|
| Modifier and Type | Method and Description |
|---|---|
void |
blockDecrypt(long[] c,
long[] p)
Implementation of the D(K, T, C) function.
|
void |
blockEncrypt(long[] p,
long[] c)
Implementation of the E(K, T, P) function.
|
protected static long[] |
bytesToLongs(byte[] ba) |
protected static long[] |
bytesToLongs(byte[] ba,
int offset,
int size)
Converts segment of byte array into long array.
|
byte[] |
decryptBlock(byte[] encryptedContent,
int offset)
Decrypts single block of encrypted content.
|
java.lang.String |
decryptString(byte[] encrypted)
Decrypts a string.
|
byte[] |
encryptBlock(byte[] content,
int offset)
Encrypts a block.
|
byte[] |
encryptString(java.lang.String plain)
Encrypts a string.
|
void |
init(long[] key,
long[] tweak)
Initialize the cipher using the key and the tweak value.
|
void |
init(java.lang.String keyMessage,
long tweak1,
long tweak2)
Initializes cipher in a simple way.
|
protected static byte[] |
longsToBytes(long[] la) |
decrypt, encryptpublic static final int BLOCK_SIZE_BITS_256
public static final int BLOCK_SIZE_BITS_512
public static final int BLOCK_SIZE_BITS_1024
public Threefish(int blockSize)
blockSize - either 256, 512 or 1024 (bits)public Threefish(int blockSize,
int rounds)
blockSize - either 256, 512 or 1024 (bits)rounds - the number of rounds 1..2^31, must be multiple of 4public void init(long[] key,
long[] tweak)
key - the Threefish key to usetweak - the tweak values to usepublic void blockEncrypt(long[] p,
long[] c)
p - the initial plain textc - the final value defined as value v{d} where d = N{r}public void blockDecrypt(long[] c,
long[] p)
c - the cipher textp - the plain textpublic void init(java.lang.String keyMessage,
long tweak1,
long tweak2)
public byte[] encryptBlock(byte[] content,
int offset)
encryptBlock in class BlockCipherpublic byte[] decryptBlock(byte[] encryptedContent,
int offset)
BlockCipherdecryptBlock in class BlockCipherpublic byte[] encryptString(java.lang.String plain)
public java.lang.String decryptString(byte[] encrypted)
protected static long[] bytesToLongs(byte[] ba)
protected static long[] bytesToLongs(byte[] ba,
int offset,
int size)
protected static byte[] longsToBytes(long[] la)
Copyright © 2003-present Jodd Team