import java.io.*;
class DESCipherTest {
try {
boolean ok = validateCipher(theCph);
} catch (Exception e) {
e.printStackTrace();
return;
};
32, 1, 2, 3, 4, 5,
4, 5, 6, 7, 8, 9,
};
2, 8, 24, 14,
32, 27, 3, 9,
22, 11, 4, 25
};
};
throws Exception {
if (theMsg.length<8)
printBytes(theMsg,"Input message");
byte[] l = selectBits(theMsg,0,blockSize/2);
byte[] r = selectBits(theMsg,blockSize/2,blockSize/2);
byte[] rBackup = r;
r = selectBits(r,E); // Expansion
r = substitution6x4(r); // Substitution
printBytes(r,"R: After S boxes");
r = selectBits(r,P); // Permutation
byte[] lr = concatenateBits(r,blockSize/2,l,blockSize/2);
printBytes(lr,"After 16 rounds");
return lr;
return out;
};
int lhByte = 0;
return out;
return out;
int bLen) {
int j = 0;
setBit(out,j,val);
j++;
setBit(out,j,val);
j++;
return out;
setBit(out,i,val);
return out;
setBit(out,i,val);
return out;
return valInt;
data[posByte] = newByte;
System.out.println("");
System.out.println(name+":");
System.out.print(byteToBits(data[i])+" ");
System.out.println();
return buf.toString();
String[] strKeys = {
subKeys[k] = theKey;
return subKeys;
return theMsg;
boolean ok = true;
if (cipherByte!=cipher[i]) ok = false;
return ok;