Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Decipher a string using the affine cipher
ResourceFunction["AffineDecipher"][string,{a,b}] deciphers string using the affine cipher with parameters a and b. | |
ResourceFunction["AffineDecipher"][{a,b}] represents an operator form of ResourceFunction["AffineDecipher"] that can be applied to an expression. |

Convert a simple text:
| In[1]:= |
| Out[1]= |
AffineDecipher automatically maps over a list of strings:
| In[2]:= |
| Out[2]= |
Create an operator:
| In[3]:= |
| Out[3]= |
Apply the operator to a string:
| In[4]:= |
| Out[4]= |
The Caesar decipher can be recreated using the affine decipher by choosing a=1:
| In[5]:= |
| Out[5]= |
AffineDecipher could be recast in terms of the resource function AffineCipher:
| In[6]:= |
| Out[6]= |
Again decipher, this time using AffineCipher with appropriate parameter values for inverting:
| In[7]:= |
| Out[7]= |
The parameter a must be coprime to 26:
| In[8]:= |
| Out[8]= |
Some of the permissible values for a are:
| In[9]:= |
| Out[9]= |
This work is licensed under a Creative Commons Attribution 4.0 International License