Using a substitution cipher to encode and decode messages