Cryptoquip Generator [0.64 KB]

By Arigateaux on Oct 31, 2013

"A cryptogram is a type of puzzle that consists of a short piece of encrypted text. Generally the cipher used to encrypt the text is simple enough that cryptogram can be solved by hand. Frequently used are substitution ciphers where each letter is replaced by a different letter or number. To solve the puzzle, one must recover the original lettering. Though once used in more serious applications, they are now mainly printed for entertainment in newspapers and magazines." -- Wikipedia


This is a cryptogram (aka cryptoquip in many newspapers) generator. It gathers a random set of letters and substitutes them with the original letters to create a cryptic message. It can be somewhat entertaining when you're bored. I haven't turned it into a game, but if people want to use it to turn it into one or I have enough requests to turn it into one. Just give credit if you use it for anything.

alias crypto {
  var %phrase = $iif($1-, $1-, The quick brown fox jumped over the lazy dogs.)

  var %alphabet = a b c d e f g h i j k l m n o p q r s t u v w x y z
  while (1) {
    var %n = $r(1, 26)
    var %letter = $gettok(%alphabet, %n, 32)
    var %crypto = $addtok(%crypto, %letter, 32)
    if ($numtok(%crypto, 32) == 26) break

  var %n = 1
  while (%n <= 26) {
    var %old = $gettok(%alphabet, %n, 32)
    var %new = $gettok(%crypto, %n, 32)
    var %oldUpper = $upper(%old)
    var %newUpper = $upper(%new)
    var %replace = $instok(%replace, $+(%old, $chr(44), %new, $chr(44), %oldUpper, $chr(44), %newUpper), 0, 44)
    inc %n

  msg # 14 $+ %phrase
  msg # 04 $+ $replacexcs(%phrase, [ %replace ] )


Sign in to comment.
Abcdefmonkey   -  Nov 05, 2013

I made something similar to this a year ago (or more, I don't remember how long it's been). Only difference is hat it didn't use a randomly generated set of letters/numbers/symbols for replacement. It was a set string for each letter/number/etc. Also a decoder. It was just for fun with a few friends when we wanted to have random conversations in the channel without anyone knowing what it was. Lol. :P Looks good though.

Sorasyn  -  Nov 05, 2013

Long time no see my friend.

Abcdefmonkey  -  Nov 05, 2013

Agreed. Life happens. Lol. Work, school, no time for much really.

Sorasyn  -  Nov 05, 2013

Yeah I know the feeling. Been doing any coding lately?

Abcdefmonkey  -  Nov 05, 2013

Pfft. First time I've touched my desktop in almost a year. Lol. That's how much time I have -__-

Sign in to comment

Sorasyn   -  Nov 01, 2013
else continue

Is redundant since it's called at the end of an infinite loop.

By the way, care to add some description as to what the snippet actually does? As much as I can discern from the source it looks to obfuscate characters in some manner.

Yawhatnever  -  Nov 01, 2013

To me it would make more sense to ditch the /continue and /break in favor of

while ($numtok(%crypto, 32) != 26) { }

A short description explaining the purpose of the code would be useful as well. I had never heard of a cryptoquip before.

Arigateaux  -  Nov 01, 2013

I have removed the following line:

else continue

I forgot to remove it when I edited it last night, because there was another small section that I changed.

Also, @Yawhatnever I don't like the way that looks, which is why I did it the way I did. No other reason. :P

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.