Cryptography Reference
In-Depth Information
FIGURE 5.2
The code for this applet follows:
import java.math.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class TestCaesarCipherApplet extends Applet implements ActionListener {
int shift=0;
byte[] msgArray=null;
byte[] encmsgArray=null;
Label titleLabel=new Label(“Caesar Cipher Demonstration”);
Label Label1=new Label(“Plaintext”);
TextField msg=new TextField(40);
Label Label2=new Label(“Ciphertext”);
TextField encmsg=new TextField(40);
Label shiftLabel=new Label(“Shift value (0-255):”);
TextField entryShiftValue=new TextField(40);
Button encipherButton=new Button(“Encipher”);
Button decipherButton=new Button(“Decipher”);
public void init() {
setLayout(new GridLayout(9,1));
add(titleLabel);
add(Label1);
add(msg);
add(Label2);
add(encmsg);
encmsg.setEditable(false);
add(shiftLabel);
Search WWH ::




Custom Search