Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Decipher a Caesar-enciphered string
ResourceFunction["CaesarDecipher"][string,n] deciphers a Caesar-enciphered string that was enciphered by shifting letters in string by n places further in the Latin alphabet. | |
ResourceFunction["CaesarDecipher"][{s1,s2,…},n] deciphers each string si. | |
ResourceFunction["CaesarDecipher"][n] represents an operator form of ResourceFunction["CaesarDecipher"] that can be applied to an expression. |

Perform a Caesar decipher with a shift of 2:
| In[1]:= |
| Out[1]= |
Decipher a text by shifting the letters 9 positions back:
| In[2]:= |
| Out[2]= |
Cipher/decipher using a shift of n=13, also known at the ROT13 cipher:
| In[3]:= |
| Out[3]= |
| In[4]:= |
| Out[4]= |
Decipher multiple strings:
| In[5]:= |
| Out[5]= |
Create an operator form of the function that deciphers with a shift of 5:
| In[6]:= |
| Out[6]= |
Use the operator:
| In[7]:= |
| Out[7]= |
Decipher a message:
| In[8]:= |
| Out[8]= |
Decipher a message:
| In[9]:= |
| Out[9]= |
Enciphering can be done using the deciphering function but with a negative shift:
| In[10]:= |
| Out[10]= |
If the shift is an integer multiple of 26, the Caesar decipher does not affect the input string:
| In[11]:= |
| Out[11]= |
Try out all 25 options to decipher a message and find the original message:
| In[12]:= |
| Out[12]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License