Abhinav Stephen Crypto Assignment 1
Abhinav Stephen Crypto Assignment 1
Abhinav Stephen Crypto Assignment 1
Name:M.Abhinav Stephen
ID:190C2030035
Code in C or C++ or java/Python for implementing the following functions required in a cipher: split,
combine, swap, circular shift, tables P-box and S-box (both sides) and one Round of the non-Feistel
cipher.
class Crypto {
output[1] = inword.substring(splitIndex);
return output;
output += outword[0];
output += outword[1];
return output;
if (direction == "left") {
} else {
return inword;
int j = 0;
} else {
output += "\0";
j++;
return output;
char p1 = input.charAt(0);
char p2 = input.charAt(1);
int a = Integer.parseInt(String.valueOf(p1));
int b = Integer.parseInt(String.valueOf(p2));
return (sbox[a][b]);
int v1 = Integer.parseInt(String.valueOf(word.charAt(i)));
int v2 = Integer.parseInt(String.valueOf(key.charAt(i)));
int[] pbox = { 1, 3, 6, 7, 5, 2, 0, 4 };
output = output + c;
return output;