CaesarVigenereCipherTemplate
CaesarVigenereCipherTemplate
app is an enhancement to the APCSP Mobile 6.5 Caesar cipher app that includes a Vigenère cipher. Enter text in the Plaintext or Ciphertext fields and use the buttons to encrypt or decrypt. The Caesar ListPicker
selects the shift. The Vigenère TextBox
sets the key.
This is a template app, with stubs for caesar
and vigenere
— the actual encrypt / decrypt procedures — as well as shift
.
shift
procedure so that it can be called with positive or negative shifts enables it to be used for encrypting and decrypting for both the Caesar cipher and the Vigenère cipher. An approach to implementing a signed shift
is to use modulo — however, the modulo of
(and remainder of
) operation(s) yield results on [0, n - 1]
, which is not suitable for accessing a list of length n
, whose indexes are on [1, n]
. shift
has…
Preconditions:
letter
is of length1
letter
is inalphabet
caesar
shifts the cleaned
text by a fixed amount (shift
), positively or negatively. alphabet
establishes the lexicographical order for the letters. caesar
is an abstraction that can be called from both the Encrypt and Decrypt Button
s and is an example of the accumulator pattern.vigenere
shifts the cleaned
text by an amount corresponding to the letters of key
, positively (if direction
is 1
) or negatively (if direction
is -1
). alphabet
establishes the lexicographical order for the letters. vigenere
is an abstraction that can be called from both the Encrypt and Decrypt Button
s and is an example of the accumulator pattern.As is usual with APCSP Mobile template apps, there is an existing UX and some pre-written procedures provided. The clean
procedure is an example of the accumulator pattern. It returns text
with all characters not in alphabet
removed.
All components retain their default properties — except initial Text
for the ListPicker
is 0
on reset and Width
and Height
are set to Fill parent...
where necessary to center UX components. None of the TextBox
components are changed on reset.
🔗 permalink, 🔩 repository, and .AIA
for this page.