Note that in Sage webpages, you must evaluate the cells in order for the demonstration to work.
Here we define an alphabet:
Here we ‘encode’ our message in the alphabet:
Now we define the Shift Cryptosystem (i.e. Caesar cipher):
Now we can create a ciphertext out of our plaintext and a key. Here we use key=1, i.e. a shift by 1 character:
Now we can decipher using the same key:
Here’s a sandbox for you to play with: