Basic Examples
Basic Examples
Perform a Caesar decipher with a shift of 2:
In[]:=
Out[]=
abcde
Decipher a text by shifting the letters 9 positions back:
In[]:=
Out[]=
Sander
Scope
Scope
Cipher/decipher using a shift of , also known at the ROT13 cipher:
n=13
In[]:=
Out[]=
Purref!
In[]:=
Out[]=
Cheers!
Decipher multiple strings:
In[]:=
Out[]=
{Awesome,devil,epic}
Create an operator form of the function that deciphers with a shift of 5:
In[]:=
op=[5]
Out[]=
Use the operator:
In[]:=
op["junh"]
Out[]=
epic
Applications
Applications
Decipher a message:
In[]:=
Out[]=
This is a deciphered message for you!
Decipher a message:
In[]:=
Out[]=
Secret message: The Wolfram language is fun!
Properties and Relations
Properties and Relations
Enciphering can be done using the deciphering function but with a negative shift:
In[]:=
ResourceFunction["CaesarCipher"]["This is a test.",10]===["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["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
Neat Examples
Try out all 25 options to decipher a message and find the original message:
In[]:=
GridTablei,["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? |