public class LC4 extends Object
Note: Class LC4 is not multiple thread safe.
Modifier and Type | Field and Description |
---|---|
static boolean |
trace
True to print a trace during encryption or decryption.
|
Constructor and Description |
---|
LC4()
Construct a new integer LC4 cipher.
|
Modifier and Type | Method and Description |
---|---|
void |
decrypt(int[] key,
int[] nonce,
int[] ctmsg,
int[] ptmsg)
Decrypt the given message.
|
String |
decrypt(String key,
String nonce,
String ctmsg)
Decrypt the given message.
|
void |
encrypt(int[] key,
int[] nonce,
int[] ptmsg,
int[] ctmsg)
Encrypt the given message.
|
String |
encrypt(String key,
String nonce,
String ptmsg)
Encrypt the given message.
|
public static boolean trace
public void encrypt(int[] key, int[] nonce, int[] ptmsg, int[] ctmsg)
key
- Key (input).nonce
- Nonce (input).ptmsg
- Plaintext message (input).ctmsg
- Ciphertext message (output).IllegalArgumentException
- (unchecked exception) Thrown if key, nonce, or
ptmsg does not meet the above preconditions.public void decrypt(int[] key, int[] nonce, int[] ctmsg, int[] ptmsg)
key
- Key.nonce
- Nonce.ctmsg
- Ciphertext message (input).ptmsg
- Plaintext message (output).IllegalArgumentException
- (unchecked exception) Thrown if key, nonce, or
ctmsg does not meet the above preconditions.public String encrypt(String key, String nonce, String ptmsg)
key
- Key.nonce
- Nonce.ptmsg
- Plaintext message.public String decrypt(String key, String nonce, String ctmsg)
key
- Key.nonce
- Nonce.ctmsg
- Ciphertext message.Copyright © 2017 by Alan Kaminsky. All rights reserved. Send comments to ark@cs.rit.edu.