Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Decipher a Chaocipher-enciphered string
| ResourceFunction["ChaoDecipher"][string,{αp,αp}] deciphers string using the plain text alphabet αp and the cipher alphabet αc. | 





Decipher a piece of text using unshuffled plain and cipher alphabets:
| In[1]:= | ![ResourceFunction[
 "ChaoDecipher"]["HDJHISUHBK", {CharacterRange["a", "z"], CharacterRange["a", "z"]}]](https://www.wolframcloud.com/obj/resourcesystem/images/b1f/b1f0e216-e805-40a1-bcb9-c5e16a20223a/3889b71a4725648d.png) | 
| Out[1]= |  | 
Decode a string that returns a "constant" string:
| In[2]:= | ![ResourceFunction[
 "ChaoDecipher"]["AZYXWVUTSRQPOBAZYXWVUT", {CharacterRange["a", "z"], CharacterRange["a", "z"]}]](https://www.wolframcloud.com/obj/resourcesystem/images/b1f/b1f0e216-e805-40a1-bcb9-c5e16a20223a/51e28a36548eb717.png) | 
| Out[2]= |  | 
Use random plain and cipher alphabets:
| In[3]:= | ![pa = {"L", "Z", "G", "U", "Q", "A", "X", "B", "J", "R", "T", "F", "D",
    "K", "E", "N", "Y", "P", "S", "O", "C", "M", "W", "I", "H", "V"};
ca = {"G", "W", "Z", "J", "P", "Q", "V", "R", "D", "C", "H", "X", "S",
    "U", "T", "K", "M", "E", "O", "F", "Y", "A", "I", "L", "N", "B"};
encoded = ResourceFunction["ChaoDecipher"]["APIRHQBJMSXTZDCGWWEC", {pa, ca}]](https://www.wolframcloud.com/obj/resourcesystem/images/b1f/b1f0e216-e805-40a1-bcb9-c5e16a20223a/0ded08a42d97aa07.png) | 
| Out[5]= |  | 
The resource function ChaoCipher can be used to encipher a string. First encode a piece of string:
| In[6]:= | ![pa = "PTLNBQDEOYSFAVZKGJRIHWXUMC" // Characters;
ca = "HXUCZVAMDSLKPEFJRIGTWOBNYQ" // Characters;
encoded = ResourceFunction["ChaoCipher"][
  "WELLDONEISBETTERTHANWELLSAID", {pa, ca}]](https://www.wolframcloud.com/obj/resourcesystem/images/b1f/b1f0e216-e805-40a1-bcb9-c5e16a20223a/5e8ee3005af8645b.png) | 
| Out[8]= |  | 
Now we can decipher it with ChaoDecipher:
| In[9]:= | ![ResourceFunction["ChaoDecipher"][encoded, {pa, ca}]](https://www.wolframcloud.com/obj/resourcesystem/images/b1f/b1f0e216-e805-40a1-bcb9-c5e16a20223a/135a0f1d742b67b6.png) | 
| Out[9]= |  | 
This work is licensed under a Creative Commons Attribution 4.0 International License