The implementation here is based on the document https://eprint.iacr.org/2008/329.pdf by Whitfield Diffie and George Ledin, which is a translation of Prof. LU Shu-wang's original standard.
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private static final int[] | |
| private static final int[] | |
| private int[] | |
| private static final byte[] | |
| private final int[] |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private int[] | |
| private int | |
| private int | |
| private int | |
| private int | |
| public String | getAlgorithmName()
Implements org. |
| public int | getBlockSize()
Implements org. |
| public void | init(boolean
if true the cipher is initialised for
encryption, if false for decryption. forEncryption, CipherParameters the key and other data required by the cipher. params)Implements org. |
| private int | |
| private int | |
| public int | processBlock(byte[]
the array containing the input data. in, int offset into the in array the data starts at. inOff, byte[] the array the output data will be copied into. out, int the offset into the out array the output will start at. outOff)Implements org. |
| public void | |
| private int | |
| private int | |
| private int | |
| private int |
| BLOCK_SIZE | back to summary |
|---|---|
| private static final int BLOCK_SIZE | |
| CK | back to summary |
|---|---|
| private static final int[] CK | |
| FK | back to summary |
|---|---|
| private static final int[] FK | |
| rk | back to summary |
|---|---|
| private int[] rk | |
| Sbox | back to summary |
|---|---|
| private static final byte[] Sbox | |
| X | back to summary |
|---|---|
| private final int[] X | |
| SM4Engine | back to summary |
|---|---|
| public SM4Engine() | |
| expandKey | back to summary |
|---|---|
| private int[] expandKey(boolean forEncryption, byte[] key) | |
| F0 | back to summary |
|---|---|
| private int F0(int[] X, int rk) | |
| F1 | back to summary |
|---|---|
| private int F1(int[] X, int rk) | |
| F2 | back to summary |
|---|---|
| private int F2(int[] X, int rk) | |
| F3 | back to summary |
|---|---|
| private int F3(int[] X, int rk) | |
| getAlgorithmName | back to summary |
|---|---|
| public String getAlgorithmName() Implements org. Doc from org. Return the name of the algorithm the cipher implements.
| |
| getBlockSize | back to summary |
|---|---|
| public int getBlockSize() Implements org. Doc from org. Return the block size for this cipher (in bytes).
| |
| init | back to summary |
|---|---|
| public void init(boolean forEncryption, CipherParameters params) throws IllegalArgumentException Implements org. Doc from org. Initialise the cipher.
| |
| L | back to summary |
|---|---|
| private int L(int B) | |
| L_ap | back to summary |
|---|---|
| private int L_ap(int B) | |
| processBlock | back to summary |
|---|---|
| public int processBlock(byte[] in, int inOff, byte[] out, int outOff) throws DataLengthException, IllegalStateException Implements org. Doc from org. Process one block of input from the array in and write it to the out array.
| |
| reset | back to summary |
|---|---|
| public void reset() Implements org. Doc from org. Reset the cipher. After resetting the cipher is in the same state as it was after the last init (if there was one). | |
| rotateLeft | back to summary |
|---|---|
| private int rotateLeft(int x, int bits) | |
| T | back to summary |
|---|---|
| private int T(int Z) | |
| T_ap | back to summary |
|---|---|
| private int T_ap(int Z) | |
| tau | back to summary |
|---|---|
| private int tau(int A) | |