Question: Design a 2 way string encoding function, in a language of your choice, such that the function is capable of encoding/decoding at least 16 character

Design a 2 way string encoding function, in a language of your choice, such that the function is capable of encoding/decoding at least 16 character strings. Do not use a simple cipher such as ROT13 for instance.

Template:

function transform(string input, boolean decoder) returns a string.

If the boolean is false, then the function returns an encoding of the string input. If true, then it returns a decoding of the input.

Example:

transform("cat", false) returns "h3h4"

transform("h3h4", true) returns "cat"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!