com.fasteasytrade.JRandTest.Algo
Class Skipjack
java.lang.Object
com.fasteasytrade.JRandTest.Algo.Cipher
com.fasteasytrade.JRandTest.Algo.Skipjack
- public class Skipjack
- extends Cipher
Skipjack algorithm copyright (c) 2005 Zur Aougav.
Hand translation to java from C implementation.
Originally written by Panu Rissanen 1998.06.24
optimized by Mark Tillotson 1998.06.25
optimized by Paulo Barreto 1998.06.30
gnupg support by Werner Koch 1998.07.02
- Author:
- Zur Aougav
Field Summary |
(package private) static byte[] |
fTable
The F-table byte permutation (see description of the G-box permutation) |
(package private) boolean |
initialized
|
(package private) byte[][] |
tab
|
Method Summary |
static String |
byte2hex(byte b)
|
boolean |
decrypt_block(byte[] in,
byte[] out)
Decrypt a single block of data.
|
boolean |
encrypt_block(byte[] in,
byte[] out)
Encrypt a single block of data.
|
(package private) int |
g(int w,
int i,
int j,
int k,
int l)
The key-dependent permutation G on V^16 is a four-round Feistel network.
|
(package private) int |
g0(int w)
|
(package private) int |
g1(int w)
|
(package private) int |
g2(int w)
|
(package private) int |
g3(int w)
|
(package private) int |
g4(int w)
|
(package private) int |
h(int w,
int i,
int j,
int k,
int l)
The inverse of the G permutation. |
(package private) int |
h0(int w)
|
(package private) int |
h1(int w)
|
(package private) int |
h2(int w)
|
(package private) int |
h3(int w)
|
(package private) int |
h4(int w)
|
static void |
main(String[] args)
|
(package private) boolean |
setupKey(byte[] key)
Preprocess a user key into a table to save and XOR at each F-table
access. |
void |
Test()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
initialized
boolean initialized
tab
byte[][] tab
fTable
static final byte[] fTable
- The F-table byte permutation (see description of the G-box permutation)
Skipjack
public Skipjack()
setupKey
boolean setupKey(byte[] key)
- Preprocess a user key into a table to save and XOR at each F-table
access.
- Parameters:
key
- key length must be >= 10 bytes. Process the first 10 bytes.
encrypt_block
public boolean encrypt_block(byte[] in,
byte[] out)
- Encrypt a single block of data.
In and out blocks' length must be 8 bytes.
- Returns:
- false if input and output blocks are null, or length is not = 8.
Else, true.
decrypt_block
public boolean decrypt_block(byte[] in,
byte[] out)
- Decrypt a single block of data.
In and out blocks' length must be 8 bytes.
- Returns:
- false if input and output blocks are null, or length is not = 8.
Else, true.
g
int g(int w,
int i,
int j,
int k,
int l)
- The key-dependent permutation G on V^16 is a four-round Feistel network.
The round function is a fixed byte-substitution table (permutation on
V^8), the F-table. Each round of G incorporates a single byte from the
key.
g0
int g0(int w)
g1
int g1(int w)
g2
int g2(int w)
g3
int g3(int w)
g4
int g4(int w)
h
int h(int w,
int i,
int j,
int k,
int l)
- The inverse of the G permutation.
h0
int h0(int w)
h1
int h1(int w)
h2
int h2(int w)
h3
int h3(int w)
h4
int h4(int w)
byte2hex
public static String byte2hex(byte b)
Test
public void Test()
main
public static void main(String[] args)
JRandTest at SourceForge
Copyright © 2005 Zur Aougav. All Rights Reserved.