Banana Decryption: Unpacking Caesar Cipher with Power Automate

Bala Madhusoodhanan - Feb 12 - - Dev Community

Intro:
The previous week we explored how Caesar cipher was a clever encryption technique shifts letters in the alphabet by a certain key, creating a code that baffled even the mightiest minds. The next chapter of our encryption saga – the decryption process. Imagine our Minion messengers eagerly exchanging their banana-shaped scrolls. The sender, having encrypted a message using the Caesar cipher, now passes the secret key to the recipient. It's like sharing the secret handshake to unlock the hidden wisdom.

Logic:
The key, which dictates the shift in the alphabet, becomes the key to deciphering the Minion code. It's a collaborative dance between sender and receiver, where the shared secret key holds the power to unveil the encrypted secrets.
The process of decrypting messages in Power Automate involves taking the user's input message and a secret key. Most of the steps are similar to encryption except the offset function where we would offset by using SUB math function

chunk(outputs('Alphastring'),1)[sub(outputs('GetIndex'),outputs('Key'))]
Enter fullscreen mode Exit fullscreen mode

Demo:

User Input Key Decrypted Output
JRRG2PRUQLQJ2 CAT "Good Morning "
JRRG2PRUQLQJ CAT "Good Morning"
NVVK6TVYUPUN encrypt "Good Morning"
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .