Intro:
Lets dive on mischievous world of Minions and the ancient art of encryption. Julius Caesar, the original mastermind behind a secret language Caesar cipher. It encrypts letters by shifting them over by a certain number of places in the alphabet. We call the length of shift the key. For example, if the key is 3, then A becomes D, B becomes E, C becomes F, and so on.
Logic:
The process of encrypting messages in Power Automate involves taking the user's input message and a secret key. Initially, the user's message is converted to uppercase, and the length of the secret key is recorded for subsequent steps.
toUpper(triggerBody()['text'])
To execute the encryption, a scale or array is necessary, containing all the alphabets, spaces, and numbers. A new variable is introduced to iterate through each character of the user's message and offset it based on the key length.
length(triggerBody()['text_1'])
To facilitate the offset process, the user's message is divided into an array of characters using the Chunk function.
chunk(outputs('UsrInput'),1)
The offset logic consists of two main steps. First, the index of each character in the user's message is found against the fixed list of characters.
indexof(outputs('Alphastring'),items('Apply_to_each'))
Subsequently, the lookup is offset by the length of the character
chunk(outputs('Alphastring'),1)[add(outputs('GetIndex'),outputs('Key'))]
The final step involves appending the variable after each character is successfully offset, completing the encryption process.
Demo:
User Input | Key | Encrypt Output |
---|---|---|
"Good Morning " | CAT | JRRG2PRUQLQJ2 |
"Good Morning" | CAT | JRRG2PRUQLQJ |
"Good Morning" | encrypt | NVVK6TVYUPUN |
I hope you had a good time learning about encryption and how to use Power Automate for it. Happy coding!
Top comments (3)
Awesome write up on caesar cipher. Will love to give it test run on power automate
The cool things you can do with power automate 😎
Thank you for inspiring me !!!