table stores each available character and assigns it a unique number. We use this table with Coda’s Filter() formula to map each individual character to a number.
We split the user’s Secret up into individual characters, then map each to a number.
We do the same with the user’s Password.
0
2
Secret:H e y t h e r e !
Conv to numbers: 51 74 94 1 89 77 74 87 74 2
Password: P a s s w o r d P a
Conv to numbers: 59 70 88 88 92 84 87 73 59 70
Select Step
Step 1
Step #1
Use these to walk through the steps 👇
Step 1
2
3
4
Show Formula
2
Shift each number to the right
We shift each letter of Secretover by a number of places. The number of places to shift by is determined by the user’s Password.
We then loop through the list of numbers from the user’s Secretone by one.
For each number, we find the corresponding number from Password, that’s at the same index in that array.
We add each pair up of numbers to produce a third array of numbers in the Summed column.
💡 If the password is shorter in length than the secret, we just repeat the password it until we have enough characters. Here’s what I mean:
Secret. My super long secret
Password. PasswordPasswordPass
0
3
Secret:H e y t h e r e !
Conv to numbers: 51 74 94 1 89 77 74 87 74 2
Password: P a s s w o r d P a
Conv to numbers: 59 70 88 88 92 84 87 73 59 70
Summed: 110 144 182 89 181 161 161 160 133 72
Select Step
2
Step #2
Step 1
2
3
4
Show Formula
3
Fix Summed “out of bounds” numbers
Each number in Summedwill be converted into a character to produce the final encrypted text.
It’s therefore important that we make sure each number is “in bounds”, meaning that each number has a matching character in
To do this, we use Coda’s FormulaMap()formula, which allows us to loop through arrays and process each item individually.
For numbers that are too high, we reduce each by 96 (the number of rows in our character mapping table).
This adjusted array of numbers can be seen in Adjusted Summed alongside.
For example, the first character, H maps to the number 51.
Its corresponding character in the password is P which maps to 59.
When we sum these up, we get 110.
110is out of bounds because we only have 96 rows in the character mapping table.
To fix this, we subtract 96 which gives us 14.
0
4
Secret:H e y t h e r e !
Conv to numbers: 51 74 94 1 89 77 74 87 74 2
Password: P a s s w o r d P a
Conv to numbers: 59 70 88 88 92 84 87 73 59 70
Summed: 110 144 182 89 181 161 161 160 133 72
Adjusted Summed: 14 48 86 89 85 65 65 64 37 72
Select Step
3
Step #3
Step 1
2
3
4
Show Formula
4
Convert Adjusted back to characters
Finally, we convert each number in the Adjusted Summedarray back to a character and Join()them together to produce the final Encrypted text.
Decryption
To decrypt our secret later on, we follow the same steps we’ve just run through, but instead of summingthe password’s values, we subtract the password character’s valuefrom the corresponding value of each character in the encrypted text.
Numbers that are zero or lower are adjusted to be “in bounds” by adding 96.