package otp; import java.util.Random; import java.util.Observable; public class OTP extends Observable { LinReg enc_reg = null; LinReg dec_reg = null; Random rnd = new Random(); int config; int init; String plain=""; String cipher=""; public int[] getKeys() { int [] keys = new int[2]; keys[0] = config; keys[1] = init; return keys; } public String getPlain() { return this.plain; } public String getCipher() { return this.cipher; } public void setPlain(String p) { this.plain=p; } public void setCypher(String c) { this.cipher=c; } public void encrypt() { this.cipher = this.encrypt(this.config, this.init, this.plain); } public void decrypt() { this.plain = this.decrypt(this.config, this.init, this.cipher); } public int encryptOne(int clear, int key) { int cipher_int=0; int keyBit=0; int clearBit=0; int cipherBit=0; for (int i=7;i>=0;i--) { clearBit = clear & (1<