You are Jim, a CIA agent in charge of super secret spies around the world. However, your enemies, the Naissurs, are highly trained in computer intelligence, and they can hack into your super secret communication systems. To contact your super secret spies, you must encrypt each message with a 16-character-long key. To encrypt a message, you must correspond each number of the key to each letter of the message. The number corresponding to each letter tells how many times to go ahead one letter. For example, if
3 corresponds to the letter
a, we get
a -> b -> c -> d and our new letter is
d after encryption.
Message: "Hello World"
Encrypted Message: "Ifmmq Yquog"
However, Naissurs have found your key time after time, and you find a way to have the key be dynamic. For this mission, you must create an encoder and decoder using this encryption method, such that the key is incremented every time the program decrypts a message.
Your program must take in the input
e <message> for encoding, and
d <message> for decoding. Your program also must generate a random 16-digit key upon running it. To set a key, you must be able to use the command
s <key> to define the key.
Here is an example of the inputs and outputs of a program which generated the key
>e "Jim SMELLS Nice"
Kjn TNFMMT Ojdf
>d "Kjn TNFMMT Ojdf"
Jim SMELLS Nice
>e "Hello World"
This is code-golf, so the least amount of bytes
wins the challenge solves the mission and is promoted!