Basic Examples

Perform a Caesar decipher with a shift of 2:
In[]:=
[◼]
CaesarDecipher
["cdefg",2]
Out[]=
abcde
Decipher a text by shifting the letters 9 positions back:
In[]:=
[◼]
CaesarDecipher
["Bjwmna",9]
Out[]=
Sander

Scope

Cipher/decipher using a shift of
n=13
, also known at the ROT13 cipher:
In[]:=
[◼]
CaesarDecipher
["Cheers!"]
Out[]=
Purref!
In[]:=
[◼]
CaesarDecipher
["Purref!"]
Out[]=
Cheers!
Decipher multiple strings:
In[]:=
[◼]
CaesarDecipher
[{"Fbjxtrj","ijanq","junh"},5]
Out[]=
{Awesome,devil,epic}
Create an operator form of the function that deciphers with a shift of 5:
In[]:=
op=
[◼]
CaesarDecipher
[5]
Out[]=
[◼]
CaesarDecipher
[5]
Use the operator:
In[]:=
op["junh"]
Out[]=
epic

Applications

Decipher a message:
In[]:=
[◼]
CaesarDecipher
["Ocdn dn v yzxdkczmzy hznnvbz ajm tjp!",21]
Out[]=
This is a deciphered message for you!
Decipher a message:
In[]:=
[◼]
CaesarDecipher
["Iushuj cuiiqwu: Jxu Mebvhqc bqdwkqwu yi vkd!",16]
Out[]=
Secret message: The Wolfram language is fun!

Properties and Relations

Enciphering can be done using the deciphering function but with a negative shift:
In[]:=
ResourceFunction["CaesarCipher"]["This is a test.",10]===
[◼]
CaesarDecipher
["This is a test.",-10]
Out[]=
True
If the shift is an integer multiple of 26, the Caesar decipher does not affect the input string:
In[]:=
Table
[◼]
CaesarDecipher
["Input equals output.",i26],{i,-3,3}
Out[]=
{Input equals output.,Input equals output.,Input equals output.,Input equals output.,Input equals output.,Input equals output.,Input equals output.}

Neat Examples

Try out all 25 options to decipher a message and find the original message:
In[]:=
GridTablei,
[◼]
CaesarDecipher
["Hsle td esp dpncpe xpddlrp esle hp hlye?",i],{i,25}
Out[]=
1
Grkd sc dro combod wocckqo drkd go gkxd?
2
Fqjc rb cqn bnlanc vnbbjpn cqjc fn fjwc?
3
Epib qa bpm amkzmb umaaiom bpib em eivb?
4
Doha pz aol zljyla tlzzhnl aoha dl dhua?
5
Cngz oy znk ykixkz skyygmk zngz ck cgtz?
6
Bmfy nx ymj xjhwjy rjxxflj ymfy bj bfsy?
7
Alex mw xli wigvix qiwweki xlex ai aerx?
8
Zkdw lv wkh vhfuhw phvvdjh wkdw zh zdqw?
9
Yjcv ku vjg ugetgv oguucig vjcv yg ycpv?
10
Xibu jt uif tfdsfu nfttbhf uibu xf xbou?
11
What is the secret message that we want?
12
Vgzs hr sgd rdbqds ldrrzfd sgzs vd vzms?
13
Ufyr gq rfc qcapcr kcqqyec rfyr uc uylr?
14
Texq fp qeb pbzobq jbppxdb qexq tb txkq?
15
Sdwp eo pda oaynap iaoowca pdwp sa swjp?
16
Rcvo dn ocz nzxmzo hznnvbz ocvo rz rvio?
17
Qbun cm nby mywlyn gymmuay nbun qy quhn?
18
Patm bl max lxvkxm fxlltzx matm px ptgm?
19
Ozsl ak lzw kwujwl ewkksyw lzsl ow osfl?
20
Nyrk zj kyv jvtivk dvjjrxv kyrk nv nrek?
21
Mxqj yi jxu iushuj cuiiqwu jxqj mu mqdj?
22
Lwpi xh iwt htrgti bthhpvt iwpi lt lpci?
23
Kvoh wg hvs gsqfsh asggous hvoh ks kobh?
24
Jung vf gur frperg zrffntr gung jr jnag?
25
Itmf ue ftq eqodqf yqeemsq ftmf iq imzf?