Home > Articles > Security > Software Security

CryptoNugget

Like this article? We recommend 

Like this article? We recommend

Crack The Message For Cash!

To illustrate the importance of cryptanalysis, I would like to offer a small cash prize to the first person to decrypt this message, encoded using a computer program to simulate a variation on a one-time pad. The plaintext message contains a telephone number. The first person to call that number and ask for Duplex will be sent the prize.

I used a very-slightly different algorithm for encryption than the classic one-time pad. I’ll play fair: here’s my source code for encryption and decryption, which assumes the ASCII character set:

char addmod26(char a, char b)
{
  char c;c = a - 'A';c += (b - 'A');if(c > 26)c -= 26;return c + 'A' - 1;
}
char submod26(char a, char b)
{
  char c;c = 1 + a - 'A';c -= (b - 'A');if(c < 0)c += 26;return c + 'A';
}

void encrypt(char *p, char *k)
{
  while(*p){*p = addmod26(*p, *k);p++, k++;}
}

void decrypt(char *c, char *k)
{
  while(*c){*c = submod26(*c, *k);c++, k++;}
}

Here is the ciphertext:

NOWISTHETIMEFORALLGOODMENTOCOMETOTHEAIDOFTHEIRPARTY

It just happened to come out that way. Honest!

Now, I’ll play fairer than fair, and give you the one-time pad too!

FUZAVDKSZVYHRHCAOBYBPCWOUKAPGSHJRLUXFONHGCGSYYZEEGI

You now have all the information you need to decipher the message. Happy cracking!

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.