Pig Latin
The toy of cryptography
Introduction
It is a playful cipher in which the English word is encoded by moving consonants and adding some suffix to it with relatively simpler algorithm
How to Identify
Identifying a pig latin encryption is a child's play as in a sentence encoded by pig latin all the words will end with ay
Code / Tool /Algorithm
First of all we will try to understand how can we encrypt some text using pig latin
Encoding
If the length of word is smaller than 3 character then leave it as it is
If length is more than 3 character and first character is a consonant then move all the consonants up to first vowel at the back and add a
ayat the endIf the first character is a vowel then keep the word as it is and add a
yayat the end
Decoding
If length of a word is less than 3 then keep it as it is
If length is more than 3 and the word end with
yaythen remove the prefix and check weather it form a real word or notif the word end with ay or test no 2 fails then remove the prefix ay and move consonant from the last until you get an English word
Program
before executing the current program first we need to download nltk data which you can download by using following script
Sample problem
For example we will take a question from our own Apoorv's treasure hunt
the above is a mail regarding murder of someone named Elia on analysing the lorem ipsum text we get the following part where all the words end with ay so it could be encoded using pig latin and was hidden in lorem ipsum
on decoding we get following message
col lege back upe lia
on rearranging spaces we get the message as
college back up elia
and on further investigation the name of criminal was found on college backup server
References
For exploring it further you can refer to 1. https://www.dcode.fr/pig-latin-language 2. https://en.wikipedia.org/wiki/Pig_Latin For practice problem you can refer to https://play.picoctf.org/practice
Last updated