1 Decipher the following text produced by a Caesar cipher Co

1. Decipher the following text produced by a Caesar cipher. Code to compute correlation of frequency for cryptanalysis. OR Code to use brute force with exhaustive key. LT HDGJW JFLQJX (show spaces in proper place)

Solution

static void generate(int maxlen) { int alphaLen = strlen(alphabet); int len = 0; char *buffer = malloc((maxlen + 1) * alphaLen * alphaLen); int *letters = malloc(maxlen * sizeof(int)); if (buffer == NULL || letters == NULL) { fprintf(stderr, \"Not enough memory.\ \"); exit(1); } // This for loop generates all 1 letter patterns, then 2 letters, etc, // up to the given maxlen. for (len=1;len<=maxlen;len++) { // The stride is one larger than len because each line has a \'\ \'. int i; int stride = len+1; int bufLen = stride * alphaLen * alphaLen; if (len == 1) { // Special case. The main algorithm hardcodes the last two // letters, so this case needs to be handled separately. int j = 0; bufLen = (len + 1) * alphaLen; for (i=0;i= alphaLen) letters[i] = 0; // Set this letter in the proper places in the buffer. c = alphabet[letters[i]]; for (j=i;j
 1. Decipher the following text produced by a Caesar cipher. Code to compute correlation of frequency for cryptanalysis. OR Code to use brute force with exhaust

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site