Professional Documents
Culture Documents
Expt 8
Expt 8
: 8
ELO8-
Theory-
It is a kind of transposition cipher which is also known as zigzag cipher. Below is an example.
Here Key = 3. For encryption we write the message diagonally in zigzag form in a matrix having total
rows = key and total columns = message length. Then read the matrix row wise horizontally to get
encrypted message.
#include<stdio.h>
#include<string.h>
row = row + k;
}
row = row + k;
}
row = col = 0;
k = -1;
row = row + k;
}
}
int main(){
char msg[] = "Hello World";
char enMsg[] = "Horel ollWd";
int key = 3;
encryptMsg(msg, key);
decryptMsg(enMsg, key);
return 0;
}
Output