Link to home
Start Free TrialLog in
Avatar of nocturn4l
nocturn4l

asked on

(Programming) Inverse Permutation Function with a Secret Key (for cryptography).. I just need help understanding what to do

*full instructions in the attached picture*

I just have to program these two methods (just psuedo code)... but I'm not sure what to do with int[] z.

static char[] encrypt(char[] x, int[] z)
static char[] decrypt(char[] y, int[] z)


If i understand correctly...if I have an array of:

A B C D E

i would return

E D C B A

but i'm not sure what to do with the the Z array.

please help~!  due at midnight today
nocturn4l-446009.flv
Avatar of Mick Barry
Mick Barry
Flag of Australia image

sounds like you need to use z as an index of the element

so in your loop you would do something like:


encrypted[i] = x[z[i]];

Open in new window

Avatar of nocturn4l
nocturn4l

ASKER

think i'm jus retarded... but do you think you can maybe elaborate further what you mean?  maybe using an example of the A B C D E example i gave?
for example, the encrypt function.. .the A B C D E would be passed into the function through the x array i believe.. but what would be in the z array then?
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ah ok i get it, thanks objects.   you've helped me in the past many times before.  i'll close the question when i finish just incase i have any other questions