Question: Write an ARM function that will attempt to decrypt a string encrypted using the Caesar cipher. Supposedly Caesar used this technique to encrypt messages. He

Write an ARM function that will attempt to decrypt a string encrypted using the Caesar cipher.

Supposedly Caesar used this technique to encrypt messages. He moved from the letter of the text to the third letter up in the alphabet and used that letter in the message. For example to encode the letter C he moved up three positions and used the letter F in the message. When at the end of the alphabet he wrapped around to the beginning, e.g. the letter Z was encrypted as C.

/* decrypt the string encrypted via Caesar shift */

#include

extern void init( char * encrypt ) ;

extern char * decrypt( char * encypt, int shift ) ;

void main( int argc, char * argv[] )

{

char * result ; /* pointer to decrypted string */

char encrypt[] = "GSRKVEXYPEXMSRW CSY LEZI JSYRH XLI WLMJX ZEPYI" ;

int i ;

init( encrypt ) ;

for( i = 1 ; i < 5 ; i++ ) /* loop to try various shifts */

{

result = decrypt( encrypt, i ) ;

printf( "Possible decrypt with shift %d: %s ", i, result ) ;

}

}

There are two functions that need to be written. They must both be in the same source file since the first obtains a buffer for the decrypted string and the second uses the buffer to hold the guess.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!